Whamcloud - gitweb
Added quota support code in index insert of iop mode
[fs/lustre-release.git] / lustre / osd / osd_handler.c
index 1844e6c..bd5bb5b 100644 (file)
@@ -2757,7 +2757,9 @@ static int osd_index_ea_insert(const struct lu_env *env, struct dt_object *dt,
         const struct lu_fid_pack *pack  = (const struct lu_fid_pack *)rec;
         const char               *name  = (const char *)key;
         struct osd_object        *child;
-
+#ifdef HAVE_QUOTA_SUPPORT
+        cfs_cap_t              save = current->cap_effective;
+#endif
         int rc;
 
         ENTRY;
@@ -2774,7 +2776,17 @@ static int osd_index_ea_insert(const struct lu_env *env, struct dt_object *dt,
                 RETURN(rc);
         child = osd_object_find(env, dt, fid);
         if (!IS_ERR(child)) {
+#ifdef HAVE_QUOTA_SUPPORT
+                if (ignore_quota)
+                        current->cap_effective |= CFS_CAP_SYS_RESOURCE_MASK;
+                else
+                        current->cap_effective &= ~CFS_CAP_SYS_RESOURCE_MASK;
+#endif
                 rc = osd_ea_add_rec(env, obj, child, name, th);
+
+#ifdef HAVE_QUOTA_SUPPORT
+                current->cap_effective = save;
+#endif
                 osd_object_put(env, child);
         } else {
                 rc = PTR_ERR(child);
@@ -2976,7 +2988,7 @@ static struct dt_it *osd_it_ea_init(const struct lu_env *env,
         struct osd_thread_info  *info = osd_oti_get(env);
         struct osd_it_ea        *it   = &info->oti_it_ea;
         struct lu_object        *lo   = &dt->do_lu;
-        struct dentry           *obj_dentry = &info->oti_obj_dentry;
+        struct dentry           *obj_dentry = &info->oti_it_dentry;
         ENTRY;
         LASSERT(lu_object_exists(lo));
 
@@ -3784,6 +3796,7 @@ static int __init osd_mod_init(void)
 
 static void __exit osd_mod_exit(void)
 {
+        llo_local_obj_unregister(&llod_osd_rem_obj_dir);
         class_unregister_type(LUSTRE_OSD_NAME);
 }