Whamcloud - gitweb
cleanup of md_ucred handling.
authornikita <nikita>
Thu, 28 Sep 2006 23:03:22 +0000 (23:03 +0000)
committernikita <nikita>
Thu, 28 Sep 2006 23:03:22 +0000 (23:03 +0000)
Use per-session context, introduced by last commit to store struct md_ucred.

20 files changed:
lustre/cmm/cmm_device.c
lustre/cmm/cmm_internal.h
lustre/cmm/cmm_object.c
lustre/cmm/cmm_split.c
lustre/cmm/mdc_internal.h
lustre/cmm/mdc_object.c
lustre/include/lustre_sec.h
lustre/include/md_object.h
lustre/kernel_patches/patches/ext3-orphans-delay.patch
lustre/mdd/mdd_handler.c
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_identity.c
lustre/mdt/mdt_idmap.c
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_lib.c
lustre/mdt/mdt_open.c
lustre/mdt/mdt_recovery.c
lustre/mdt/mdt_reint.c
lustre/mdt/mdt_rmtacl.c
lustre/mdt/mdt_xattr.c

index 9041211..9ab3360 100644 (file)
@@ -52,36 +52,37 @@ static inline int lu_device_is_cmm(struct lu_device *d)
 }
 
 int cmm_root_get(const struct lu_env *env, struct md_device *md,
-                 struct lu_fid *fid, struct md_ucred *uc)
+                 struct lu_fid *fid)
 {
         struct cmm_device *cmm_dev = md2cmm_dev(md);
         /* valid only on master MDS */
         if (cmm_dev->cmm_local_num == 0)
                 return cmm_child_ops(cmm_dev)->mdo_root_get(env,
-                                     cmm_dev->cmm_child, fid, uc);
+                                     cmm_dev->cmm_child, fid);
         else
                 return -EINVAL;
 }
 
 static int cmm_statfs(const struct lu_env *env, struct md_device *md,
-                      struct kstatfs *sfs, struct md_ucred *uc) {
+                      struct kstatfs *sfs)
+{
         struct cmm_device *cmm_dev = md2cmm_dev(md);
        int rc;
 
         ENTRY;
         rc = cmm_child_ops(cmm_dev)->mdo_statfs(env,
-                                                cmm_dev->cmm_child, sfs, uc);
+                                                cmm_dev->cmm_child, sfs);
         RETURN (rc);
 }
 
 static int cmm_maxsize_get(const struct lu_env *env, struct md_device *md,
-                           int *md_size, int *cookie_size, struct md_ucred *uc)
+                           int *md_size, int *cookie_size)
 {
         struct cmm_device *cmm_dev = md2cmm_dev(md);
         int rc;
         ENTRY;
         rc = cmm_child_ops(cmm_dev)->mdo_maxsize_get(env, cmm_dev->cmm_child,
-                                                     md_size, cookie_size, uc);
+                                                     md_size, cookie_size);
         RETURN(rc);
 }
 
index ed35d14..f5b9876 100644 (file)
@@ -128,7 +128,7 @@ int cmm_upcall(const struct lu_env *env, struct md_device *md,
 #ifdef HAVE_SPLIT_SUPPORT
 /* cmm_split.c */
 int cml_try_to_split(const struct lu_env *env,
-                     struct md_object *mo, struct md_ucred *uc);
+                     struct md_object *mo);
 #endif
 
 #endif /* __KERNEL__ */
index 4ba4444..799a6ee 100644 (file)
@@ -209,131 +209,128 @@ static struct lu_object_operations cml_obj_ops = {
 static int cml_object_create(const struct lu_env *env,
                              struct md_object *mo,
                              const struct md_create_spec *spec,
-                             struct md_attr *attr,
-                             struct md_ucred *uc)
+                             struct md_attr *attr)
 {
         int rc;
         ENTRY;
-        rc = mo_object_create(env, md_object_next(mo), spec, attr, uc);
+        rc = mo_object_create(env, md_object_next(mo), spec, attr);
         RETURN(rc);
 }
 
 static int cml_permission(const struct lu_env *env,
-                        struct md_object *mo, int mask, struct md_ucred *uc)
+                        struct md_object *mo, int mask)
 {
         int rc;
         ENTRY;
-        rc = mo_permission(env, md_object_next(mo), mask, uc);
+        rc = mo_permission(env, md_object_next(mo), mask);
         RETURN(rc);
 }
 
 static int cml_attr_get(const struct lu_env *env, struct md_object *mo,
-                        struct md_attr *attr, struct md_ucred *uc)
+                        struct md_attr *attr)
 {
         int rc;
         ENTRY;
-        rc = mo_attr_get(env, md_object_next(mo), attr, uc);
+        rc = mo_attr_get(env, md_object_next(mo), attr);
         RETURN(rc);
 }
 
 static int cml_attr_set(const struct lu_env *env, struct md_object *mo,
-                        const struct md_attr *attr, struct md_ucred *uc)
+                        const struct md_attr *attr)
 {
         int rc;
         ENTRY;
-        rc = mo_attr_set(env, md_object_next(mo), attr, uc);
+        rc = mo_attr_set(env, md_object_next(mo), attr);
         RETURN(rc);
 }
 
 static int cml_xattr_get(const struct lu_env *env, struct md_object *mo,
-                         struct lu_buf *buf, const char *name,
-                         struct md_ucred *uc)
+                         struct lu_buf *buf, const char *name)
 {
         int rc;
         ENTRY;
-        rc = mo_xattr_get(env, md_object_next(mo), buf, name, uc);
+        rc = mo_xattr_get(env, md_object_next(mo), buf, name);
         RETURN(rc);
 }
 
 static int cml_readlink(const struct lu_env *env, struct md_object *mo,
-                        struct lu_buf *buf, struct md_ucred *uc)
+                        struct lu_buf *buf)
 {
         int rc;
         ENTRY;
-        rc = mo_readlink(env, md_object_next(mo), buf, uc);
+        rc = mo_readlink(env, md_object_next(mo), buf);
         RETURN(rc);
 }
 
 static int cml_xattr_list(const struct lu_env *env, struct md_object *mo,
-                          struct lu_buf *buf, struct md_ucred *uc)
+                          struct lu_buf *buf)
 {
         int rc;
         ENTRY;
-        rc = mo_xattr_list(env, md_object_next(mo), buf, uc);
+        rc = mo_xattr_list(env, md_object_next(mo), buf);
         RETURN(rc);
 }
 
 static int cml_xattr_set(const struct lu_env *env, struct md_object *mo,
                          const struct lu_buf *buf,
-                         const char *name, int fl, struct md_ucred *uc)
+                         const char *name, int fl)
 {
         int rc;
         ENTRY;
-        rc = mo_xattr_set(env, md_object_next(mo), buf, name, fl, uc);
+        rc = mo_xattr_set(env, md_object_next(mo), buf, name, fl);
         RETURN(rc);
 }
 
 static int cml_xattr_del(const struct lu_env *env, struct md_object *mo,
-                         const char *name, struct md_ucred *uc)
+                         const char *name)
 {
         int rc;
         ENTRY;
-        rc = mo_xattr_del(env, md_object_next(mo), name, uc);
+        rc = mo_xattr_del(env, md_object_next(mo), name);
         RETURN(rc);
 }
 
-static int cml_ref_add(const struct lu_env *env, struct md_object *mo,
-                       struct md_ucred *uc)
+static int cml_ref_add(const struct lu_env *env, struct md_object *mo)
 {
         int rc;
         ENTRY;
-        rc = mo_ref_add(env, md_object_next(mo), uc);
+        rc = mo_ref_add(env, md_object_next(mo));
         RETURN(rc);
 }
 
 static int cml_ref_del(const struct lu_env *env, struct md_object *mo,
-                       struct md_attr *ma, struct md_ucred *uc)
+                       struct md_attr *ma)
 {
         int rc;
         ENTRY;
-        rc = mo_ref_del(env, md_object_next(mo), ma, uc);
+        rc = mo_ref_del(env, md_object_next(mo), ma);
         RETURN(rc);
 }
 
 static int cml_open(const struct lu_env *env, struct md_object *mo,
-                    int flags, struct md_ucred *uc)
+                    int flags)
 {
         int rc;
         ENTRY;
-        rc = mo_open(env, md_object_next(mo), flags, uc);
+        rc = mo_open(env, md_object_next(mo), flags);
         RETURN(rc);
 }
 
 static int cml_close(const struct lu_env *env, struct md_object *mo,
-                     struct md_attr *ma, struct md_ucred *uc)
+                     struct md_attr *ma)
 {
         int rc;
         ENTRY;
-        rc = mo_close(env, md_object_next(mo), ma, uc);
+        rc = mo_close(env, md_object_next(mo), ma);
         RETURN(rc);
 }
 
 static int cml_readpage(const struct lu_env *env, struct md_object *mo,
-                        const struct lu_rdpg *rdpg, struct md_ucred *uc)
+                        const struct lu_rdpg *rdpg)
 {
         int rc;
         ENTRY;
-        rc = mo_readpage(env, md_object_next(mo), rdpg, uc);
+        rc = mo_readpage(env, md_object_next(mo), rdpg);
         RETURN(rc);
 }
 
@@ -366,11 +363,11 @@ static struct md_object_operations cml_mo_ops = {
 
 /* md_dir operations */
 static int cml_lookup(const struct lu_env *env, struct md_object *mo_p,
-                      const char *name, struct lu_fid *lf, struct md_ucred *uc)
+                      const char *name, struct lu_fid *lf)
 {
         int rc;
         ENTRY;
-        rc = mdo_lookup(env, md_object_next(mo_p), name, lf, uc);
+        rc = mdo_lookup(env, md_object_next(mo_p), name, lf);
         RETURN(rc);
 
 }
@@ -378,19 +375,19 @@ static int cml_lookup(const struct lu_env *env, struct md_object *mo_p,
 static int cml_create(const struct lu_env *env,
                       struct md_object *mo_p, const char *child_name,
                       struct md_object *mo_c, const struct md_create_spec *spec,
-                      struct md_attr *ma, struct md_ucred *uc)
+                      struct md_attr *ma)
 {
         int rc;
         ENTRY;
 
 #ifdef HAVE_SPLIT_SUPPORT
-        rc = cml_try_to_split(env, mo_p, uc);
+        rc = cml_try_to_split(env, mo_p);
         if (rc)
                 RETURN(rc);
 #endif
 
         rc = mdo_create(env, md_object_next(mo_p), child_name,
-                        md_object_next(mo_c), spec, ma, uc);
+                        md_object_next(mo_c), spec, ma);
 
 
         RETURN(rc);
@@ -399,34 +396,34 @@ static int cml_create(const struct lu_env *env,
 static int cml_create_data(const struct lu_env *env, struct md_object *p,
                            struct md_object *o,
                            const struct md_create_spec *spec,
-                           struct md_attr *ma, struct md_ucred *uc)
+                           struct md_attr *ma)
 {
         int rc;
         ENTRY;
         rc = mdo_create_data(env, md_object_next(p), md_object_next(o),
-                             spec, ma, uc);
+                             spec, ma);
         RETURN(rc);
 }
 
 static int cml_link(const struct lu_env *env, struct md_object *mo_p,
                     struct md_object *mo_s, const char *name,
-                    struct md_attr *ma, struct md_ucred *uc)
+                    struct md_attr *ma)
 {
         int rc;
         ENTRY;
         rc = mdo_link(env, md_object_next(mo_p), md_object_next(mo_s),
-                      name, ma, uc);
+                      name, ma);
         RETURN(rc);
 }
 
 static int cml_unlink(const struct lu_env *env, struct md_object *mo_p,
                       struct md_object *mo_c, const char *name,
-                      struct md_attr *ma, struct md_ucred *uc)
+                      struct md_attr *ma)
 {
         int rc;
         ENTRY;
         rc = mdo_unlink(env, md_object_next(mo_p), md_object_next(mo_c),
-                        name, ma, uc);
+                        name, ma);
         RETURN(rc);
 }
 
@@ -450,8 +447,7 @@ struct md_object *md_object_find(const struct lu_env *env,
 }
 
 static int __cmm_mode_get(const struct lu_env *env, struct md_device *md,
-                          const struct lu_fid *lf, struct md_attr *ma,
-                          struct md_ucred *uc)
+                          const struct lu_fid *lf, struct md_attr *ma)
 {
         struct cmm_thread_info *cmi;
         struct md_object *mo_s = md_object_find(env, md, lf);
@@ -468,7 +464,7 @@ static int __cmm_mode_get(const struct lu_env *env, struct md_device *md,
         tmp_ma->ma_need = MA_INODE;
 
         /* get type from src, can be remote req */
-        rc = mo_attr_get(env, md_object_next(mo_s), tmp_ma, uc);
+        rc = mo_attr_get(env, md_object_next(mo_s), tmp_ma);
         if (rc == 0) {
                 ma->ma_attr.la_mode = tmp_ma->ma_attr.la_mode;
                 ma->ma_attr.la_flags = tmp_ma->ma_attr.la_flags;
@@ -481,19 +477,18 @@ static int __cmm_mode_get(const struct lu_env *env, struct md_device *md,
 static int cml_rename(const struct lu_env *env, struct md_object *mo_po,
                       struct md_object *mo_pn, const struct lu_fid *lf,
                       const char *s_name, struct md_object *mo_t,
-                      const char *t_name, struct md_attr *ma,
-                      struct md_ucred *uc)
+                      const char *t_name, struct md_attr *ma)
 {
         int rc;
         ENTRY;
 
-        rc = __cmm_mode_get(env, md_obj2dev(mo_po), lf, ma, uc);
+        rc = __cmm_mode_get(env, md_obj2dev(mo_po), lf, ma);
         if (rc != 0)
                 RETURN(rc);
 
         if (mo_t && lu_object_exists(&mo_t->mo_lu) < 0) {
                 /* mo_t is remote object and there is RPC to unlink it */
-                rc = mo_ref_del(env, md_object_next(mo_t), ma, uc);
+                rc = mo_ref_del(env, md_object_next(mo_t), ma);
                 if (rc)
                         RETURN(rc);
                 mo_t = NULL;
@@ -502,53 +497,50 @@ static int cml_rename(const struct lu_env *env, struct md_object *mo_po,
         /* local rename, mo_t can be NULL */
         rc = mdo_rename(env, md_object_next(mo_po),
                         md_object_next(mo_pn), lf, s_name,
-                        md_object_next(mo_t), t_name, ma, uc);
+                        md_object_next(mo_t), t_name, ma);
         RETURN(rc);
 }
 
 static int cml_rename_tgt(const struct lu_env *env, struct md_object *mo_p,
                           struct md_object *mo_t, const struct lu_fid *lf,
-                          const char *name, struct md_attr *ma,
-                          struct md_ucred *uc)
+                          const char *name, struct md_attr *ma)
 {
         int rc;
         ENTRY;
 
         rc = mdo_rename_tgt(env, md_object_next(mo_p),
-                            md_object_next(mo_t), lf, name, ma, uc);
+                            md_object_next(mo_t), lf, name, ma);
         RETURN(rc);
 }
 /* used only in case of rename_tgt() when target is not exist */
 static int cml_name_insert(const struct lu_env *env, struct md_object *p,
-                           const char *name, const struct lu_fid *lf, int isdir,
-                           struct md_ucred *uc)
+                           const char *name, const struct lu_fid *lf, int isdir)
 {
         int rc;
         ENTRY;
 
-        rc = mdo_name_insert(env, md_object_next(p), name, lf, isdir, uc);
+        rc = mdo_name_insert(env, md_object_next(p), name, lf, isdir);
 
         RETURN(rc);
 }
 
 /* Common method for remote and local use. */
 static int cmm_is_subdir(const struct lu_env *env, struct md_object *mo,
-                         const struct lu_fid *fid, struct lu_fid *sfid,
-                         struct md_ucred *uc)
+                         const struct lu_fid *fid, struct lu_fid *sfid)
 {
         struct cmm_thread_info *cmi;
         int rc;
         ENTRY;
 
         cmi = lu_context_key_get(&env->le_ctx, &cmm_thread_key);
-        rc = __cmm_mode_get(env, md_obj2dev(mo), fid, &cmi->cmi_ma, uc);
+        rc = __cmm_mode_get(env, md_obj2dev(mo), fid, &cmi->cmi_ma);
         if (rc)
                 RETURN(rc);
 
         if (!S_ISDIR(cmi->cmi_ma.ma_attr.la_mode))
                 RETURN(0);
 
-        rc = mdo_is_subdir(env, md_object_next(mo), fid, sfid, uc);
+        rc = mdo_is_subdir(env, md_object_next(mo), fid, sfid);
         RETURN(rc);
 }
 
@@ -648,88 +640,84 @@ static struct lu_object_operations cmr_obj_ops = {
 static int cmr_object_create(const struct lu_env *env,
                              struct md_object *mo,
                              const struct md_create_spec *spec,
-                             struct md_attr *ma,
-                             struct md_ucred *uc)
+                             struct md_attr *ma)
 {
         RETURN(-EFAULT);
 }
 
 static int cmr_permission(const struct lu_env *env, struct md_object *mo,
-                          int mask, struct md_ucred *uc)
+                          int mask)
 {
         RETURN(-EREMOTE);
 }
 
 static int cmr_attr_get(const struct lu_env *env, struct md_object *mo,
-                        struct md_attr *attr, struct md_ucred *uc)
+                        struct md_attr *attr)
 {
         RETURN(-EREMOTE);
 }
 
 static int cmr_attr_set(const struct lu_env *env, struct md_object *mo,
-                        const struct md_attr *attr, struct md_ucred *uc)
+                        const struct md_attr *attr)
 {
         RETURN(-EFAULT);
 }
 
 static int cmr_xattr_get(const struct lu_env *env, struct md_object *mo,
-                         struct lu_buf *buf, const char *name,
-                         struct md_ucred *uc)
+                         struct lu_buf *buf, const char *name)
 {
         RETURN(-EFAULT);
 }
 
 static int cmr_readlink(const struct lu_env *env, struct md_object *mo,
-                        struct lu_buf *buf, struct md_ucred *uc)
+                        struct lu_buf *buf)
 {
         RETURN(-EFAULT);
 }
 
 static int cmr_xattr_list(const struct lu_env *env, struct md_object *mo,
-                          struct lu_buf *buf, struct md_ucred *uc)
+                          struct lu_buf *buf)
 {
         RETURN(-EFAULT);
 }
 
 static int cmr_xattr_set(const struct lu_env *env, struct md_object *mo,
-                         const struct lu_buf *buf, const char *name, int fl,
-                         struct md_ucred *uc)
+                         const struct lu_buf *buf, const char *name, int fl)
 {
         RETURN(-EFAULT);
 }
 
 static int cmr_xattr_del(const struct lu_env *env, struct md_object *mo,
-                         const char *name, struct md_ucred *uc)
+                         const char *name)
 {
         RETURN(-EFAULT);
 }
 
-static int cmr_ref_add(const struct lu_env *env, struct md_object *mo,
-                       struct md_ucred *uc)
+static int cmr_ref_add(const struct lu_env *env, struct md_object *mo)
 {
         RETURN(-EFAULT);
 }
 
 static int cmr_ref_del(const struct lu_env *env, struct md_object *mo,
-                       struct md_attr *ma, struct md_ucred *uc)
+                       struct md_attr *ma)
 {
         RETURN(-EFAULT);
 }
 
 static int cmr_open(const struct lu_env *env, struct md_object *mo,
-                    int flags, struct md_ucred *uc)
+                    int flags)
 {
         RETURN(-EREMOTE);
 }
 
 static int cmr_close(const struct lu_env *env, struct md_object *mo,
-                     struct md_attr *ma, struct md_ucred *uc)
+                     struct md_attr *ma)
 {
         RETURN(-EFAULT);
 }
 
 static int cmr_readpage(const struct lu_env *env, struct md_object *mo,
-                        const struct lu_rdpg *rdpg, struct md_ucred *uc)
+                        const struct lu_rdpg *rdpg)
 {
         RETURN(-EREMOTE);
 }
@@ -760,7 +748,7 @@ static struct md_object_operations cmr_mo_ops = {
 
 /* remote part of md_dir operations */
 static int cmr_lookup(const struct lu_env *env, struct md_object *mo_p,
-                      const char *name, struct lu_fid *lf, struct md_ucred *uc)
+                      const char *name, struct lu_fid *lf)
 {
         /*
          * This can happens while rename() If new parent is remote dir, lookup
@@ -783,7 +771,7 @@ static int cmr_lookup(const struct lu_env *env, struct md_object *mo_p,
 static int cmr_create(const struct lu_env *env, struct md_object *mo_p,
                       const char *child_name, struct md_object *mo_c,
                       const struct md_create_spec *spec,
-                      struct md_attr *ma, struct md_ucred *uc)
+                      struct md_attr *ma)
 {
         struct cmm_thread_info *cmi;
         struct md_attr *tmp_ma;
@@ -795,7 +783,7 @@ static int cmr_create(const struct lu_env *env, struct md_object *mo_p,
         LASSERT(cmi);
         tmp_ma = &cmi->cmi_ma;
         tmp_ma->ma_need = MA_INODE;
-        rc = mo_attr_get(env, md_object_next(mo_p), tmp_ma, uc);
+        rc = mo_attr_get(env, md_object_next(mo_p), tmp_ma);
         if (rc)
                 RETURN(rc);
 
@@ -807,11 +795,11 @@ static int cmr_create(const struct lu_env *env, struct md_object *mo_p,
                 }
         }
         /* remote object creation and local name insert */
-        rc = mo_object_create(env, md_object_next(mo_c), spec, ma, uc);
+        rc = mo_object_create(env, md_object_next(mo_c), spec, ma);
         if (rc == 0) {
                 rc = mdo_name_insert(env, md_object_next(mo_p),
                                      child_name, lu_object_fid(&mo_c->mo_lu),
-                                     S_ISDIR(ma->ma_attr.la_mode), uc);
+                                     S_ISDIR(ma->ma_attr.la_mode));
         }
 
         RETURN(rc);
@@ -819,17 +807,17 @@ static int cmr_create(const struct lu_env *env, struct md_object *mo_p,
 
 static int cmr_link(const struct lu_env *env, struct md_object *mo_p,
                     struct md_object *mo_s, const char *name,
-                    struct md_attr *ma, struct md_ucred *uc)
+                    struct md_attr *ma)
 {
         int rc;
         ENTRY;
 
         //XXX: make sure that MDT checks name isn't exist
 
-        rc = mo_ref_add(env, md_object_next(mo_s), uc);
+        rc = mo_ref_add(env, md_object_next(mo_s));
         if (rc == 0) {
                 rc = mdo_name_insert(env, md_object_next(mo_p),
-                                     name, lu_object_fid(&mo_s->mo_lu), 0, uc);
+                                     name, lu_object_fid(&mo_s->mo_lu), 0);
         }
 
         RETURN(rc);
@@ -837,14 +825,14 @@ static int cmr_link(const struct lu_env *env, struct md_object *mo_p,
 
 static int cmr_unlink(const struct lu_env *env, struct md_object *mo_p,
                       struct md_object *mo_c, const char *name,
-                      struct md_attr *ma, struct md_ucred *uc)
+                      struct md_attr *ma)
 {
         int rc;
         ENTRY;
 
-        rc = mo_ref_del(env, md_object_next(mo_c), ma, uc);
+        rc = mo_ref_del(env, md_object_next(mo_c), ma);
         if (rc == 0) {
-                rc = mdo_name_remove(env, md_object_next(mo_p), name, uc);
+                rc = mdo_name_remove(env, md_object_next(mo_p), name);
         }
 
         RETURN(rc);
@@ -854,13 +842,13 @@ static int cmr_rename(const struct lu_env *env,
                       struct md_object *mo_po, struct md_object *mo_pn,
                       const struct lu_fid *lf, const char *s_name,
                       struct md_object *mo_t, const char *t_name,
-                      struct md_attr *ma, struct md_ucred *uc)
+                      struct md_attr *ma)
 {
         int rc;
         ENTRY;
 
         /* get real type of src */
-        rc = __cmm_mode_get(env, md_obj2dev(mo_po), lf, ma, uc);
+        rc = __cmm_mode_get(env, md_obj2dev(mo_po), lf, ma);
         if (rc != 0)
                 RETURN(rc);
 
@@ -869,11 +857,11 @@ static int cmr_rename(const struct lu_env *env,
          * mo_t or not. Therefore mo_t is NULL here but remote server should do
          * lookup and process this further */
         rc = mdo_rename_tgt(env, md_object_next(mo_pn),
-                            NULL/* mo_t */, lf, t_name, ma, uc);
+                            NULL/* mo_t */, lf, t_name, ma);
         /* only old name is removed localy */
         if (rc == 0)
                 rc = mdo_name_remove(env, md_object_next(mo_po),
-                                     s_name, uc);
+                                     s_name);
 
         RETURN(rc);
 }
@@ -883,16 +871,16 @@ static int cmr_rename(const struct lu_env *env,
 static int cmr_rename_tgt(const struct lu_env *env,
                           struct md_object *mo_p, struct md_object *mo_t,
                           const struct lu_fid *lf, const char *name,
-                          struct md_attr *ma, struct md_ucred *uc)
+                          struct md_attr *ma)
 {
         int rc;
         ENTRY;
         /* target object is remote one */
-        rc = mo_ref_del(env, md_object_next(mo_t), ma, uc);
+        rc = mo_ref_del(env, md_object_next(mo_t), ma);
         /* continue locally with name handling only */
         if (rc == 0)
                 rc = mdo_rename_tgt(env, md_object_next(mo_p),
-                                    NULL, lf, name, ma, uc);
+                                    NULL, lf, name, ma);
         RETURN(rc);
 }
 
index 6815f31..3ac1c21 100644 (file)
@@ -55,8 +55,7 @@ static inline struct lu_fid* cmm2_fid(struct cmm_object *obj)
 
 static int cmm_expect_splitting(const struct lu_env *env,
                                 struct md_object *mo,
-                                struct md_attr *ma,
-                                struct md_ucred *uc)
+                                struct md_attr *ma)
 {
         struct cmm_device *cmm = cmm_obj2dev(md2cmm_obj(mo));
         struct lu_fid *fid = NULL;
@@ -72,7 +71,7 @@ static int cmm_expect_splitting(const struct lu_env *env,
         if (ma->ma_lmv_size)
                 GOTO(cleanup, rc = CMM_NO_SPLIT_EXPECTED);
         OBD_ALLOC_PTR(fid);
-        rc = cmm_child_ops(cmm)->mdo_root_get(env, cmm->cmm_child, fid, uc);
+        rc = cmm_child_ops(cmm)->mdo_root_get(env, cmm->cmm_child, fid);
         if (rc)
                 GOTO(cleanup, rc);
 
@@ -155,7 +154,7 @@ static int cmm_creat_remote_obj(const struct lu_env *env,
                                 struct cmm_device *cmm,
                                 struct lu_fid *fid, struct md_attr *ma,
                                 const struct lmv_stripe_md *lmv,
-                                int lmv_size, struct md_ucred *uc)
+                                int lmv_size)
 {
         struct cmm_object *obj;
         struct md_create_spec *spec;
@@ -175,7 +174,7 @@ static int cmm_creat_remote_obj(const struct lu_env *env,
         spec->u.sp_ea.eadatalen = lmv_size;
         spec->sp_cr_flags |= MDS_CREATE_SLAVE_OBJ;
         rc = mo_object_create(env, md_object_next(&obj->cmo_obj),
-                              spec, ma, uc);
+                              spec, ma);
         OBD_FREE_PTR(spec);
 
         cmm_object_put(env, obj);
@@ -183,8 +182,7 @@ static int cmm_creat_remote_obj(const struct lu_env *env,
 }
 
 static int cmm_create_slave_objects(const struct lu_env *env,
-                                    struct md_object *mo, struct md_attr *ma,
-                                    struct md_ucred *uc)
+                                    struct md_object *mo, struct md_attr *ma)
 {
         struct cmm_device *cmm = cmm_obj2dev(md2cmm_obj(mo));
         struct lmv_stripe_md *lmv = NULL, *slave_lmv = NULL;
@@ -219,7 +217,7 @@ static int cmm_create_slave_objects(const struct lu_env *env,
         slave_lmv->mea_count = 0;
         for (i = 1; i < cmm->cmm_tgt_count + 1; i ++) {
                 rc = cmm_creat_remote_obj(env, cmm, &lmv->mea_ids[i], ma,
-                                          slave_lmv, sizeof(slave_lmv), uc);
+                                          slave_lmv, sizeof(slave_lmv));
                 if (rc)
                         GOTO(cleanup, rc);
         }
@@ -234,8 +232,7 @@ cleanup:
 
 static int cmm_send_split_pages(const struct lu_env *env,
                                 struct md_object *mo, struct lu_rdpg *rdpg,
-                                struct lu_fid *fid, int len,
-                                struct md_ucred *uc)
+                                struct lu_fid *fid, int len)
 {
         struct cmm_device *cmm = cmm_obj2dev(md2cmm_obj(mo));
         struct cmm_object *obj;
@@ -247,14 +244,14 @@ static int cmm_send_split_pages(const struct lu_env *env,
                 RETURN(PTR_ERR(obj));
 
         rc = mdc_send_page(cmm, env, md_object_next(&obj->cmo_obj),
-                           rdpg->rp_pages[0], len, uc);
+                           rdpg->rp_pages[0], len);
         cmm_object_put(env, obj);
         RETURN(rc);
 }
 
 static int cmm_remove_entries(const struct lu_env *env,
                               struct md_object *mo, struct lu_rdpg *rdpg,
-                              __u32 hash_end, __u32 *len, struct md_ucred *uc)
+                              __u32 hash_end, __u32 *len)
 {
         struct lu_dirpage *dp;
         struct lu_dirent  *ent;
@@ -275,7 +272,7 @@ static int cmm_remove_entries(const struct lu_env *env,
                                 OBD_ALLOC(name, ent->lde_namelen + 1);
                                 memcpy(name, ent->lde_name, ent->lde_namelen);
                                 rc = mdo_name_remove(env, md_object_next(mo),
-                                                     name, uc);
+                                                     name);
                                 OBD_FREE(name, ent->lde_namelen + 1);
                         }
                         if (rc) {
@@ -301,7 +298,7 @@ unmap:
 
 static int cmm_split_entries(const struct lu_env *env,
                              struct md_object *mo, struct lu_rdpg *rdpg,
-                             struct lu_fid *lf, __u32 end, struct md_ucred *uc)
+                             struct lu_fid *lf, __u32 end)
 {
         int rc, done = 0;
         ENTRY;
@@ -317,7 +314,7 @@ static int cmm_split_entries(const struct lu_env *env,
                 memset(kmap(rdpg->rp_pages[0]), 0, CFS_PAGE_SIZE);
                 kunmap(rdpg->rp_pages[0]);
 
-                rc = mo_readpage(env, md_object_next(mo), rdpg, uc);
+                rc = mo_readpage(env, md_object_next(mo), rdpg);
                 /* -E2BIG means it already reach the end of the dir */
                 if (rc) {
                         if (rc != -ERANGE) {
@@ -328,13 +325,13 @@ static int cmm_split_entries(const struct lu_env *env,
                 }
 
                 /* Remove the old entries */
-                rc = cmm_remove_entries(env, mo, rdpg, end, &len, uc);
+                rc = cmm_remove_entries(env, mo, rdpg, end, &len);
                 if (rc)
                         RETURN(rc);
 
                 /* Send page to slave object */
                 if (len > 0) {
-                        rc = cmm_send_split_pages(env, mo, rdpg, lf, len, uc);
+                        rc = cmm_send_split_pages(env, mo, rdpg, lf, len);
                         if (rc)
                                 RETURN(rc);
                 }
@@ -352,8 +349,7 @@ static int cmm_split_entries(const struct lu_env *env,
 }
 #define SPLIT_PAGE_COUNT 1
 static int cmm_scan_and_split(const struct lu_env *env,
-                              struct md_object *mo, struct md_attr *ma,
-                              struct md_ucred *uc)
+                              struct md_object *mo, struct md_attr *ma)
 {
         struct cmm_device *cmm = cmm_obj2dev(md2cmm_obj(mo));
         __u32 hash_segement;
@@ -384,7 +380,7 @@ static int cmm_scan_and_split(const struct lu_env *env,
 
                 rdpg->rp_hash = i * hash_segement;
                 hash_end = rdpg->rp_hash + hash_segement;
-                rc = cmm_split_entries(env, mo, rdpg, lf, hash_end, uc);
+                rc = cmm_split_entries(env, mo, rdpg, lf, hash_end);
                 if (rc)
                         GOTO(cleanup, rc);
         }
@@ -402,8 +398,7 @@ free_rdpg:
         RETURN(rc);
 }
 
-int cml_try_to_split(const struct lu_env *env, struct md_object *mo,
-                     struct md_ucred *uc)
+int cml_try_to_split(const struct lu_env *env, struct md_object *mo)
 {
         struct cmm_device *cmm = cmm_obj2dev(md2cmm_obj(mo));
         struct md_attr *ma;
@@ -417,12 +412,12 @@ int cml_try_to_split(const struct lu_env *env, struct md_object *mo,
                 RETURN(-ENOMEM);
 
         ma->ma_need = MA_INODE|MA_LMV;
-        rc = mo_attr_get(env, mo, ma, uc);
+        rc = mo_attr_get(env, mo, ma);
         if (rc)
                 GOTO(cleanup, ma);
 
         /* step1: checking whether the dir need to be splitted */
-        rc = cmm_expect_splitting(env, mo, ma, uc);
+        rc = cmm_expect_splitting(env, mo, ma);
         if (rc != CMM_EXPECT_SPLIT)
                 GOTO(cleanup, rc = 0);
 
@@ -434,18 +429,18 @@ int cml_try_to_split(const struct lu_env *env, struct md_object *mo,
                 GOTO(cleanup, rc = 0);
 
         /* step2: create slave objects */
-        rc = cmm_create_slave_objects(env, mo, ma, uc);
+        rc = cmm_create_slave_objects(env, mo, ma);
         if (rc)
                 GOTO(cleanup, ma);
 
         /* step3: scan and split the object */
-        rc = cmm_scan_and_split(env, mo, ma, uc);
+        rc = cmm_scan_and_split(env, mo, ma);
         if (rc)
                 GOTO(cleanup, ma);
 
         /* step4: set mea to the master object */
         rc = mo_xattr_set(env, md_object_next(mo), ma->ma_lmv,
-                          ma->ma_lmv_size, MDS_LMV_MD_NAME, 0, uc);
+                          ma->ma_lmv_size, MDS_LMV_MD_NAME, 0);
 
         if (rc == -ERESTART)
                 CWARN("Dir"DFID" has been split \n",
index 7d08740..1be19ff 100644 (file)
@@ -98,8 +98,7 @@ struct lu_object *mdc_object_alloc(const struct lu_env *,
                                    struct lu_device *);
 #ifdef HAVE_SPLIT_SUPPORT
 int mdc_send_page(struct cmm_device *cmm, const struct lu_env *env,
-                  struct md_object *mo, struct page *page, __u32 end,
-                  struct md_ucred *uc);
+                  struct md_object *mo, struct page *page, __u32 end);
 #endif
 
 #endif /* __KERNEL__ */
index 63e2627..4c403b8 100644 (file)
@@ -203,7 +203,7 @@ static int mdc_req2attr_update(const struct lu_env *env,
 }
 
 static int mdc_attr_get(const struct lu_env *env, struct md_object *mo,
-                        struct md_attr *ma, struct md_ucred *uc)
+                        struct md_attr *ma)
 {
         struct mdc_device *mc = md2mdc_dev(md_obj2dev(mo));
         struct mdc_thread_info *mci;
@@ -235,13 +235,13 @@ static int mdc_attr_get(const struct lu_env *env, struct md_object *mo,
 static int mdc_object_create(const struct lu_env *env,
                              struct md_object *mo,
                              const struct md_create_spec *spec,
-                             struct md_attr *ma,
-                             struct md_ucred *uc)
+                             struct md_attr *ma)
 {
         struct mdc_device *mc = md2mdc_dev(md_obj2dev(mo));
         struct lu_attr *la = &ma->ma_attr;
         struct mdc_thread_info *mci;
         const void *symname;
+        struct md_ucred *uc = md_ucred(env);
         int rc, symlen;
         uid_t uid;
         gid_t gid;
@@ -296,11 +296,11 @@ static int mdc_object_create(const struct lu_env *env,
         RETURN(rc);
 }
 
-static int mdc_ref_add(const struct lu_env *env, struct md_object *mo,
-                       struct md_ucred *uc)
+static int mdc_ref_add(const struct lu_env *env, struct md_object *mo)
 {
         struct mdc_device *mc = md2mdc_dev(md_obj2dev(mo));
         struct mdc_thread_info *mci;
+        struct md_ucred *uc = md_ucred(env);
         int rc;
         ENTRY;
 
@@ -341,11 +341,12 @@ static int mdc_ref_add(const struct lu_env *env, struct md_object *mo,
 }
 
 static int mdc_ref_del(const struct lu_env *env, struct md_object *mo,
-                       struct md_attr *ma, struct md_ucred *uc)
+                       struct md_attr *ma)
 {
         struct mdc_device *mc = md2mdc_dev(md_obj2dev(mo));
         struct lu_attr *la = &ma->ma_attr;
         struct mdc_thread_info *mci;
+        struct md_ucred *uc = md_ucred(env);
         int rc;
         ENTRY;
 
@@ -382,8 +383,7 @@ static int mdc_ref_del(const struct lu_env *env, struct md_object *mo,
 
 #ifdef HAVE_SPLIT_SUPPORT
 int mdc_send_page(struct cmm_device *cm, const struct lu_env *env,
-                  struct md_object *mo, struct page *page, __u32 offset,
-                  struct md_ucred *uc)
+                  struct md_object *mo, struct page *page, __u32 offset)
 {
         struct mdc_device *mc = md2mdc_dev(md_obj2dev(mo));
         int rc;
@@ -407,12 +407,12 @@ static struct md_object_operations mdc_mo_ops = {
 /* md_dir_operations */
 static int mdc_rename_tgt(const struct lu_env *env, struct md_object *mo_p,
                           struct md_object *mo_t, const struct lu_fid *lf,
-                          const char *name, struct md_attr *ma,
-                          struct md_ucred *uc)
+                          const char *name, struct md_attr *ma)
 {
         struct mdc_device *mc = md2mdc_dev(md_obj2dev(mo_p));
         struct lu_attr *la = &ma->ma_attr;
         struct mdc_thread_info *mci;
+        struct md_ucred *uc = md_ucred(env);
         int rc;
         ENTRY;
 
@@ -453,8 +453,7 @@ static int mdc_rename_tgt(const struct lu_env *env, struct md_object *mo_p,
 }
 
 static int mdc_is_subdir(const struct lu_env *env, struct md_object *mo,
-                         const struct lu_fid *fid, struct lu_fid *sfid,
-                         struct md_ucred *uc)
+                         const struct lu_fid *fid, struct lu_fid *sfid)
 {
         struct mdc_device *mc = md2mdc_dev(md_obj2dev(mo));
         struct mdc_thread_info *mci;
index 388d583..6554cb6 100644 (file)
@@ -511,4 +511,6 @@ int bulk_csum_cli_reply(struct ptlrpc_bulk_desc *desc, int read,
 int bulk_csum_svc(struct ptlrpc_bulk_desc *desc, int read,
                   struct lustre_msg *vmsg, int voff,
                   struct lustre_msg *rmsg, int roff);
+
+
 #endif /* _LUSTRE_SEC_H_ */
index ad6318b..c922405 100644 (file)
@@ -71,6 +71,14 @@ struct md_ucred {
        struct mdt_identity    *mu_identity;
 };
 
+/*
+ * Implemented in mdd/mdd_handler.c.
+ *
+ * XXX should be moved into separate .h/.c together with all md security
+ * related definitions.
+ */
+struct md_ucred *md_ucred(const struct lu_env *env);
+
 /* metadata attributes */
 enum ma_valid {
         MA_INODE = (1 << 0),
@@ -118,69 +126,49 @@ struct md_create_spec {
  */
 struct md_object_operations {
         int (*moo_permission)(const struct lu_env *env,
-                              struct md_object *obj,
-                              int mask,
-                              struct md_ucred *uc);
+                              struct md_object *obj, int mask);
 
-        int (*moo_attr_get)(const struct lu_env *env,
-                            struct md_object *obj,
-                            struct md_attr *attr,
-                            struct md_ucred *uc);
+        int (*moo_attr_get)(const struct lu_env *env, struct md_object *obj,
+                            struct md_attr *attr);
 
-        int (*moo_attr_set)(const struct lu_env *env,
-                            struct md_object *obj,
-                            const struct md_attr *attr,
-                            struct md_ucred *uc);
+        int (*moo_attr_set)(const struct lu_env *env, struct md_object *obj,
+                            const struct md_attr *attr);
 
         int (*moo_xattr_get)(const struct lu_env *env, struct md_object *obj,
-                             struct lu_buf *buf, const char *name,
-                             struct md_ucred *uc);
+                             struct lu_buf *buf, const char *name);
 
         int (*moo_xattr_list)(const struct lu_env *env, struct md_object *obj,
-                              struct lu_buf *buf, struct md_ucred *uc);
+                              struct lu_buf *buf);
 
         int (*moo_xattr_set)(const struct lu_env *env, struct md_object *obj,
                              const struct lu_buf *buf, const char *name,
-                             int fl, struct md_ucred *uc);
+                             int fl);
 
-        int (*moo_xattr_del)(const struct lu_env *env,
-                             struct md_object *obj,
-                             const char *name,
-                             struct md_ucred *uc);
+        int (*moo_xattr_del)(const struct lu_env *env, struct md_object *obj,
+                             const char *name);
 
-        int (*moo_readpage)(const struct lu_env *env,
-                            struct md_object *obj,
-                            const struct lu_rdpg *rdpg,
-                            struct md_ucred *uc);
+        int (*moo_readpage)(const struct lu_env *env, struct md_object *obj,
+                            const struct lu_rdpg *rdpg);
 
         int (*moo_readlink)(const struct lu_env *env, struct md_object *obj,
-                            struct lu_buf *buf, struct md_ucred *uc);
+                            struct lu_buf *buf);
 
         /* part of cross-ref operation */
         int (*moo_object_create)(const struct lu_env *env,
                                  struct md_object *obj,
                                  const struct md_create_spec *spec,
-                                 struct md_attr *ma,
-                                 struct md_ucred *uc);
+                                 struct md_attr *ma);
 
-        int (*moo_ref_add)(const struct lu_env *env,
-                           struct md_object *obj,
-                           struct md_ucred *uc);
+        int (*moo_ref_add)(const struct lu_env *env, struct md_object *obj);
 
         int (*moo_ref_del)(const struct lu_env *env,
-                           struct md_object *obj,
-                           struct md_attr *ma,
-                           struct md_ucred *uc);
+                           struct md_object *obj, struct md_attr *ma);
 
         int (*moo_open)(const struct lu_env *env,
-                        struct md_object *obj,
-                        int flag,
-                        struct md_ucred *uc);
-
-        int (*moo_close)(const struct lu_env *env,
-                         struct md_object *obj,
-                         struct md_attr *ma,
-                         struct md_ucred *uc);
+                        struct md_object *obj, int flag);
+
+        int (*moo_close)(const struct lu_env *env, struct md_object *obj,
+                         struct md_attr *ma);
         int (*moo_capa_get)(const struct lu_env *, struct md_object *,
                             struct lustre_capa *);
 };
@@ -189,96 +177,59 @@ struct md_object_operations {
  * Operations implemented for each directory object.
  */
 struct md_dir_operations {
-        int (*mdo_is_subdir) (const struct lu_env *env,
-                              struct md_object *obj,
-                              const struct lu_fid *fid,
-                              struct lu_fid *sfid,
-                              struct md_ucred *uc);
-
-        int (*mdo_lookup)(const struct lu_env *env,
-                          struct md_object *obj,
-                          const char *name,
-                          struct lu_fid *fid,
-                          struct md_ucred *uc);
-
-        int (*mdo_create)(const struct lu_env *env,
-                          struct md_object *pobj,
-                          const char *name,
-                          struct md_object *child,
+        int (*mdo_is_subdir) (const struct lu_env *env, struct md_object *obj,
+                              const struct lu_fid *fid, struct lu_fid *sfid);
+
+        int (*mdo_lookup)(const struct lu_env *env, struct md_object *obj,
+                          const char *name, struct lu_fid *fid);
+
+        int (*mdo_create)(const struct lu_env *env, struct md_object *pobj,
+                          const char *name, struct md_object *child,
                           const struct md_create_spec *spec,
-                          struct md_attr *ma,
-                          struct md_ucred *uc);
+                          struct md_attr *ma);
 
         /* This method is used for creating data object for this meta object*/
-        int (*mdo_create_data)(const struct lu_env *env,
-                               struct md_object *p,
+        int (*mdo_create_data)(const struct lu_env *env, struct md_object *p,
                                struct md_object *o,
                                const struct md_create_spec *spec,
-                               struct md_attr *ma,
-                               struct md_ucred *uc);
-
-        int (*mdo_rename)(const struct lu_env *env,
-                          struct md_object *spobj,
-                          struct md_object *tpobj,
-                          const struct lu_fid *lf,
-                          const char *sname,
-                          struct md_object *tobj,
-                          const char *tname,
-                          struct md_attr *ma,
-                          struct md_ucred *uc);
-
-        int (*mdo_link)(const struct lu_env *env,
-                        struct md_object *tgt_obj,
-                        struct md_object *src_obj,
-                        const char *name,
-                        struct md_attr *ma,
-                        struct md_ucred *uc);
-
-        int (*mdo_unlink)(const struct lu_env *env,
-                          struct md_object *pobj,
-                          struct md_object *cobj,
-                          const char *name,
-                          struct md_attr *ma,
-                          struct md_ucred *uc);
+                               struct md_attr *ma);
+
+        int (*mdo_rename)(const struct lu_env *env, struct md_object *spobj,
+                          struct md_object *tpobj, const struct lu_fid *lf,
+                          const char *sname, struct md_object *tobj,
+                          const char *tname, struct md_attr *ma);
+
+        int (*mdo_link)(const struct lu_env *env, struct md_object *tgt_obj,
+                        struct md_object *src_obj, const char *name,
+                        struct md_attr *ma);
+
+        int (*mdo_unlink)(const struct lu_env *env, struct md_object *pobj,
+                          struct md_object *cobj, const char *name,
+                          struct md_attr *ma);
 
         /* partial ops for cross-ref case */
-        int (*mdo_name_insert)(const struct lu_env *env,
-                               struct md_object *obj,
-                               const char *name,
-                               const struct lu_fid *fid,
-                               int isdir,
-                               struct md_ucred *uc);
+        int (*mdo_name_insert)(const struct lu_env *env, struct md_object *obj,
+                               const char *name, const struct lu_fid *fid,
+                               int isdir);
 
         int (*mdo_name_remove)(const struct lu_env *env,
-                               struct md_object *obj, const char *name,
-                               struct md_ucred *uc);
-
-        int (*mdo_rename_tgt)(const struct lu_env *env,
-                              struct md_object *pobj,
-                              struct md_object *tobj,
-                              const struct lu_fid *fid,
-                              const char *name,
-                              struct md_attr *ma,
-                              struct md_ucred *uc);
+                               struct md_object *obj, const char *name);
+
+        int (*mdo_rename_tgt)(const struct lu_env *env, struct md_object *pobj,
+                              struct md_object *tobj, const struct lu_fid *fid,
+                              const char *name, struct md_attr *ma);
 };
 
 struct md_device_operations {
         /* meta-data device related handlers. */
-        int (*mdo_root_get)(const struct lu_env *env,
-                            struct md_device *m,
-                            struct lu_fid *f,
-                            struct md_ucred *uc);
-
-        int (*mdo_maxsize_get)(const struct lu_env *env,
-                               struct md_device *m,
-                               int *md_size,
-                               int *cookie_size,
-                               struct md_ucred *uc);
-
-        int (*mdo_statfs)(const struct lu_env *env,
-                          struct md_device *m,
-                          struct kstatfs *sfs,
-                          struct md_ucred *uc);
+        int (*mdo_root_get)(const struct lu_env *env, struct md_device *m,
+                            struct lu_fid *f);
+
+        int (*mdo_maxsize_get)(const struct lu_env *env, struct md_device *m,
+                               int *md_size, int *cookie_size);
+
+        int (*mdo_statfs)(const struct lu_env *env, struct md_device *m,
+                          struct kstatfs *sfs);
 
         int (*mdo_init_capa_keys)(struct md_device *m,
                                   struct lustre_capa_key *keys);
@@ -358,131 +309,117 @@ static inline void md_device_fini(struct md_device *md)
 /* md operations */
 static inline int mo_permission(const struct lu_env *env,
                                 struct md_object *m,
-                                int mask,
-                                struct md_ucred *uc)
+                                int mask)
 {
         LASSERT(m->mo_ops->moo_permission);
-        return m->mo_ops->moo_permission(env, m, mask, uc);
+        return m->mo_ops->moo_permission(env, m, mask);
 }
 
 static inline int mo_attr_get(const struct lu_env *env,
                               struct md_object *m,
-                              struct md_attr *at,
-                              struct md_ucred *uc)
+                              struct md_attr *at)
 {
         LASSERT(m->mo_ops->moo_attr_get);
-        return m->mo_ops->moo_attr_get(env, m, at, uc);
+        return m->mo_ops->moo_attr_get(env, m, at);
 }
 
 static inline int mo_readlink(const struct lu_env *env,
                               struct md_object *m,
-                              struct lu_buf *buf,
-                              struct md_ucred *uc)
+                              struct lu_buf *buf)
 {
         LASSERT(m->mo_ops->moo_readlink);
-        return m->mo_ops->moo_readlink(env, m, buf, uc);
+        return m->mo_ops->moo_readlink(env, m, buf);
 }
 
 static inline int mo_attr_set(const struct lu_env *env,
                               struct md_object *m,
-                              const struct md_attr *at,
-                              struct md_ucred *uc)
+                              const struct md_attr *at)
 {
         LASSERT(m->mo_ops->moo_attr_set);
-        return m->mo_ops->moo_attr_set(env, m, at, uc);
+        return m->mo_ops->moo_attr_set(env, m, at);
 }
 
 static inline int mo_xattr_get(const struct lu_env *env,
                                struct md_object *m,
                                struct lu_buf *buf,
-                               const char *name,
-                               struct md_ucred *uc)
+                               const char *name)
 {
         LASSERT(m->mo_ops->moo_xattr_get);
-        return m->mo_ops->moo_xattr_get(env, m, buf, name, uc);
+        return m->mo_ops->moo_xattr_get(env, m, buf, name);
 }
 
 static inline int mo_xattr_del(const struct lu_env *env,
                                struct md_object *m,
-                               const char *name,
-                               struct md_ucred *uc)
+                               const char *name)
 {
         LASSERT(m->mo_ops->moo_xattr_del);
-        return m->mo_ops->moo_xattr_del(env, m, name, uc);
+        return m->mo_ops->moo_xattr_del(env, m, name);
 }
 
 static inline int mo_xattr_set(const struct lu_env *env,
                                struct md_object *m,
                                const struct lu_buf *buf,
                                const char *name,
-                               int flags,
-                               struct md_ucred *uc)
+                               int flags)
 {
         LASSERT(m->mo_ops->moo_xattr_set);
-        return m->mo_ops->moo_xattr_set(env, m, buf, name, flags, uc);
+        return m->mo_ops->moo_xattr_set(env, m, buf, name, flags);
 }
 
 static inline int mo_xattr_list(const struct lu_env *env,
                                 struct md_object *m,
-                                struct lu_buf *buf,
-                                struct md_ucred *uc)
+                                struct lu_buf *buf)
 {
         LASSERT(m->mo_ops->moo_xattr_list);
-        return m->mo_ops->moo_xattr_list(env, m, buf, uc);
+        return m->mo_ops->moo_xattr_list(env, m, buf);
 }
 
 static inline int mo_open(const struct lu_env *env,
                           struct md_object *m,
-                          int flags,
-                          struct md_ucred *uc)
+                          int flags)
 {
         LASSERT(m->mo_ops->moo_open);
-        return m->mo_ops->moo_open(env, m, flags, uc);
+        return m->mo_ops->moo_open(env, m, flags);
 }
 
 static inline int mo_close(const struct lu_env *env,
                            struct md_object *m,
-                           struct md_attr *ma,
-                           struct md_ucred *uc)
+                           struct md_attr *ma)
 {
         LASSERT(m->mo_ops->moo_close);
-        return m->mo_ops->moo_close(env, m, ma, uc);
+        return m->mo_ops->moo_close(env, m, ma);
 }
 
 static inline int mo_readpage(const struct lu_env *env,
                               struct md_object *m,
-                              const struct lu_rdpg *rdpg,
-                              struct md_ucred *uc)
+                              const struct lu_rdpg *rdpg)
 {
         LASSERT(m->mo_ops->moo_readpage);
-        return m->mo_ops->moo_readpage(env, m, rdpg, uc);
+        return m->mo_ops->moo_readpage(env, m, rdpg);
 }
 
 static inline int mo_object_create(const struct lu_env *env,
                                    struct md_object *m,
                                    const struct md_create_spec *spc,
-                                   struct md_attr *at,
-                                   struct md_ucred *uc)
+                                   struct md_attr *at)
 {
         LASSERT(m->mo_ops->moo_object_create);
-        return m->mo_ops->moo_object_create(env, m, spc, at, uc);
+        return m->mo_ops->moo_object_create(env, m, spc, at);
 }
 
 static inline int mo_ref_add(const struct lu_env *env,
-                             struct md_object *m,
-                             struct md_ucred *uc)
+                             struct md_object *m)
 {
         LASSERT(m->mo_ops->moo_ref_add);
-        return m->mo_ops->moo_ref_add(env, m, uc);
+        return m->mo_ops->moo_ref_add(env, m);
 }
 
 static inline int mo_ref_del(const struct lu_env *env,
                              struct md_object *m,
-                             struct md_attr *ma,
-                             struct md_ucred *uc)
+                             struct md_attr *ma)
 {
         LASSERT(m->mo_ops->moo_ref_del);
-        return m->mo_ops->moo_ref_del(env, m, ma, uc);
+        return m->mo_ops->moo_ref_del(env, m, ma);
 }
 
 static inline int mo_capa_get(const struct lu_env *env,
@@ -496,11 +433,10 @@ static inline int mo_capa_get(const struct lu_env *env,
 static inline int mdo_lookup(const struct lu_env *env,
                              struct md_object *p,
                              const char *name,
-                             struct lu_fid *f,
-                             struct md_ucred *uc)
+                             struct lu_fid *f)
 {
         LASSERT(p->mo_dir_ops->mdo_lookup);
-        return p->mo_dir_ops->mdo_lookup(env, p, name, f, uc);
+        return p->mo_dir_ops->mdo_lookup(env, p, name, f);
 }
 
 static inline int mdo_create(const struct lu_env *env,
@@ -508,22 +444,20 @@ static inline int mdo_create(const struct lu_env *env,
                              const char *child_name,
                              struct md_object *c,
                              const struct md_create_spec *spc,
-                             struct md_attr *at,
-                             struct md_ucred *uc)
+                             struct md_attr *at)
 {
         LASSERT(c->mo_dir_ops->mdo_create);
-        return c->mo_dir_ops->mdo_create(env, p, child_name, c, spc, at, uc);
+        return c->mo_dir_ops->mdo_create(env, p, child_name, c, spc, at);
 }
 
 static inline int mdo_create_data(const struct lu_env *env,
                                   struct md_object *p,
                                   struct md_object *c,
                                   const struct md_create_spec *spec,
-                                  struct md_attr *ma,
-                                  struct md_ucred *uc)
+                                  struct md_attr *ma)
 {
         LASSERT(c->mo_dir_ops->mdo_create_data);
-        return c->mo_dir_ops->mdo_create_data(env, p, c, spec, ma, uc);
+        return c->mo_dir_ops->mdo_create_data(env, p, c, spec, ma);
 }
 
 static inline int mdo_rename(const struct lu_env *env,
@@ -533,64 +467,57 @@ static inline int mdo_rename(const struct lu_env *env,
                              const char *sname,
                              struct md_object *t,
                              const char *tname,
-                             struct md_attr *ma,
-                             struct md_ucred *uc)
+                             struct md_attr *ma)
 {
         LASSERT(tp->mo_dir_ops->mdo_rename);
-        return tp->mo_dir_ops->mdo_rename(env, sp, tp, lf, sname, t, tname,
-                                          ma, uc);
+        return tp->mo_dir_ops->mdo_rename(env, sp, tp, lf, sname, t, tname, ma);
 }
 
 static inline int mdo_is_subdir(const struct lu_env *env,
                                 struct md_object *mo,
                                 const struct lu_fid *fid,
-                                struct lu_fid *sfid,
-                                struct md_ucred *uc)
+                                struct lu_fid *sfid)
 {
         LASSERT(mo->mo_dir_ops->mdo_is_subdir);
-        return mo->mo_dir_ops->mdo_is_subdir(env, mo, fid, sfid, uc);
+        return mo->mo_dir_ops->mdo_is_subdir(env, mo, fid, sfid);
 }
 
 static inline int mdo_link(const struct lu_env *env,
                            struct md_object *p,
                            struct md_object *s,
                            const char *name,
-                           struct md_attr *ma,
-                           struct md_ucred *uc)
+                           struct md_attr *ma)
 {
         LASSERT(s->mo_dir_ops->mdo_link);
-        return s->mo_dir_ops->mdo_link(env, p, s, name, ma, uc);
+        return s->mo_dir_ops->mdo_link(env, p, s, name, ma);
 }
 
 static inline int mdo_unlink(const struct lu_env *env,
                              struct md_object *p,
                              struct md_object *c,
                              const char *name,
-                             struct md_attr *ma,
-                             struct md_ucred *uc)
+                             struct md_attr *ma)
 {
         LASSERT(c->mo_dir_ops->mdo_unlink);
-        return c->mo_dir_ops->mdo_unlink(env, p, c, name, ma, uc);
+        return c->mo_dir_ops->mdo_unlink(env, p, c, name, ma);
 }
 
 static inline int mdo_name_insert(const struct lu_env *env,
                                   struct md_object *p,
                                   const char *name,
                                   const struct lu_fid *f,
-                                  int isdir,
-                                  struct md_ucred *uc)
+                                  int isdir)
 {
         LASSERT(p->mo_dir_ops->mdo_name_insert);
-        return p->mo_dir_ops->mdo_name_insert(env, p, name, f, isdir, uc);
+        return p->mo_dir_ops->mdo_name_insert(env, p, name, f, isdir);
 }
 
 static inline int mdo_name_remove(const struct lu_env *env,
                                   struct md_object *p,
-                                  const char *name,
-                                  struct md_ucred *uc)
+                                  const char *name)
 {
         LASSERT(p->mo_dir_ops->mdo_name_remove);
-        return p->mo_dir_ops->mdo_name_remove(env, p, name, uc);
+        return p->mo_dir_ops->mdo_name_remove(env, p, name);
 }
 
 static inline int mdo_rename_tgt(const struct lu_env *env,
@@ -598,17 +525,14 @@ static inline int mdo_rename_tgt(const struct lu_env *env,
                                  struct md_object *t,
                                  const struct lu_fid *lf,
                                  const char *name,
-                                 struct md_attr *ma,
-                                 struct md_ucred *uc)
+                                 struct md_attr *ma)
 {
         if (t) {
                 LASSERT(t->mo_dir_ops->mdo_rename_tgt);
-                return t->mo_dir_ops->mdo_rename_tgt(env, p, t, lf, name,
-                                                     ma, uc);
+                return t->mo_dir_ops->mdo_rename_tgt(env, p, t, lf, name, ma);
         } else {
                 LASSERT(p->mo_dir_ops->mdo_rename_tgt);
-                return p->mo_dir_ops->mdo_rename_tgt(env, p, t, lf, name,
-                                                     ma, uc);
+                return p->mo_dir_ops->mdo_rename_tgt(env, p, t, lf, name, ma);
         }
 }
 
index fad98e7..8348f9e 100644 (file)
@@ -1,7 +1,7 @@
 Index: iam/fs/ext3/super.c
 ===================================================================
---- iam.orig/fs/ext3/super.c   2006-09-29 01:08:34.000000000 +0400
-+++ iam/fs/ext3/super.c        2006-09-29 01:08:34.000000000 +0400
+--- iam.orig/fs/ext3/super.c   2006-09-29 02:41:03.000000000 +0400
++++ iam/fs/ext3/super.c        2006-09-29 02:41:03.000000000 +0400
 @@ -1168,8 +1168,8 @@ static int ext3_check_descriptors (struc
   * e2fsck was run on this filesystem, and it must have already done the orphan
   * inode cleanup for us, so we can safely abort without any further action.
index 3a2ce3a..5a5a662 100644 (file)
@@ -58,18 +58,16 @@ static void __mdd_ref_del(const struct lu_env *env, struct mdd_object *obj,
 static int __mdd_lookup(const struct lu_env *env,
                         struct md_object *pobj,
                         const char *name, const struct lu_fid* fid,
-                        int mask, struct md_ucred *uc);
+                        int mask);
 static int __mdd_lookup_locked(const struct lu_env *env,
                                struct md_object *pobj,
                                const char *name, const struct lu_fid* fid,
-                               int mask, struct md_ucred *uc);
+                               int mask);
 static int mdd_exec_permission_lite(const struct lu_env *env,
-                                    struct mdd_object *obj,
-                                    struct md_ucred *uc);
+                                    struct mdd_object *obj);
 static int __mdd_permission_internal(const struct lu_env *env,
                                      struct mdd_object *obj,
-                                     int mask, int getattr,
-                                     struct md_ucred *uc);
+                                     int mask, int getattr);
 
 static struct md_object_operations mdd_obj_ops;
 static struct md_dir_operations    mdd_dir_ops;
@@ -291,10 +289,9 @@ static int mdd_in_group_p(struct md_ucred *uc, gid_t grp)
 }
 
 static inline int mdd_permission_internal(const struct lu_env *env,
-                                          struct mdd_object *obj, int mask,
-                                          struct md_ucred *uc)
+                                          struct mdd_object *obj, int mask)
 {
-        return __mdd_permission_internal(env, obj, mask, 1, uc);
+        return __mdd_permission_internal(env, obj, mask, 1);
 }
 
 struct mdd_thread_info *mdd_env_info(const struct lu_env *env)
@@ -449,7 +446,7 @@ static inline int mdd_is_dead_obj(struct mdd_object *obj)
 /*Check whether it may create the cobj under the pobj*/
 static int mdd_may_create(const struct lu_env *env,
                           struct mdd_object *pobj, struct mdd_object *cobj,
-                          int need_check, struct md_ucred *uc)
+                          int need_check)
 {
         int rc = 0;
         ENTRY;
@@ -463,7 +460,7 @@ static int mdd_may_create(const struct lu_env *env,
         /*check pobj may create or not*/
         if (need_check)
                 rc = mdd_permission_internal(env, pobj,
-                                             MAY_WRITE | MAY_EXEC, uc);
+                                             MAY_WRITE | MAY_EXEC);
 
         RETURN(rc);
 }
@@ -521,10 +518,10 @@ static inline int mdd_capable(struct md_ucred *uc, int cap)
  */
 static inline int mdd_is_sticky(const struct lu_env *env,
                                 struct mdd_object *pobj,
-                                struct mdd_object *cobj,
-                                struct md_ucred *uc)
+                                struct mdd_object *cobj)
 {
         struct lu_attr *tmp_la = &mdd_env_info(env)->mti_la;
+        struct md_ucred *uc = md_ucred(env);
         int rc;
 
         rc = __mdd_la_get(env, cobj, tmp_la);
@@ -548,7 +545,7 @@ static inline int mdd_is_sticky(const struct lu_env *env,
 /*Check whether it may delete the cobj under the pobj*/
 static int mdd_may_delete(const struct lu_env *env,
                           struct mdd_object *pobj, struct mdd_object *cobj,
-                          int is_dir, int need_check, struct md_ucred *uc)
+                          int is_dir, int need_check)
 {
         struct mdd_device *mdd = mdo2mdd(&cobj->mod_obj);
         int rc = 0;
@@ -577,12 +574,12 @@ static int mdd_may_delete(const struct lu_env *env,
                 if (mdd_is_dead_obj(pobj))
                         RETURN(-ENOENT);
 
-                if (mdd_is_sticky(env, pobj, cobj, uc))
+                if (mdd_is_sticky(env, pobj, cobj))
                         RETURN(-EPERM);
 
                 if (need_check)
                         rc = mdd_permission_internal(env, pobj,
-                                                     MAY_WRITE | MAY_EXEC, uc);
+                                                     MAY_WRITE | MAY_EXEC);
         }
         RETURN(rc);
 }
@@ -671,7 +668,7 @@ static inline int mdd_attr_get_internal_locked(const struct lu_env *env,
  * No permission check is needed.
  */
 static int mdd_attr_get(const struct lu_env *env, struct md_object *obj,
-                        struct md_attr *ma, struct md_ucred *uc)
+                        struct md_attr *ma)
 {
         struct mdd_object *mdd_obj = md2mdd_obj(obj);
         int                rc;
@@ -686,7 +683,7 @@ static int mdd_attr_get(const struct lu_env *env, struct md_object *obj,
  */
 static int mdd_xattr_get(const struct lu_env *env,
                          struct md_object *obj, struct lu_buf *buf,
-                         const char *name, struct md_ucred *uc)
+                         const char *name)
 {
         struct mdd_object *mdd_obj = md2mdd_obj(obj);
         struct dt_object  *next;
@@ -709,7 +706,7 @@ static int mdd_xattr_get(const struct lu_env *env,
  * no need check again.
  */
 static int mdd_readlink(const struct lu_env *env, struct md_object *obj,
-                        struct lu_buf *buf, struct md_ucred *uc)
+                        struct lu_buf *buf)
 {
         struct mdd_object *mdd_obj = md2mdd_obj(obj);
         struct dt_object  *next;
@@ -727,7 +724,7 @@ static int mdd_readlink(const struct lu_env *env, struct md_object *obj,
 }
 
 static int mdd_xattr_list(const struct lu_env *env, struct md_object *obj,
-                          struct lu_buf *buf, struct md_ucred *uc)
+                          struct lu_buf *buf)
 {
         struct mdd_object *mdd_obj = md2mdd_obj(obj);
         struct dt_object  *next;
@@ -1025,9 +1022,10 @@ static int __mdd_xattr_set(const struct lu_env *env, struct mdd_object *o,
  * and port to
  */
 int mdd_fix_attr(const struct lu_env *env, struct mdd_object *obj,
-                 struct lu_attr *la, struct md_ucred *uc)
+                 struct lu_attr *la)
 {
         struct lu_attr   *tmp_la     = &mdd_env_info(env)->mti_la;
+        struct md_ucred  *uc         = md_ucred(env);
         time_t            now        = CURRENT_SECONDS;
         int               rc;
         ENTRY;
@@ -1163,7 +1161,7 @@ int mdd_fix_attr(const struct lu_env *env, struct mdd_object *obj,
 
         /* For tuncate (or setsize), we should have MAY_WRITE perm */
         if (la->la_valid & (LA_SIZE | LA_BLOCKS)) {
-                rc = mdd_permission_internal(env, obj, MAY_WRITE, uc);
+                rc = mdd_permission_internal(env, obj, MAY_WRITE);
                 if (rc)
                         RETURN(rc);
 
@@ -1196,7 +1194,7 @@ int mdd_fix_attr(const struct lu_env *env, struct mdd_object *obj,
 
 /* set attr and LOV EA at once, return updated attr */
 static int mdd_attr_set(const struct lu_env *env, struct md_object *obj,
-                        const struct md_attr *ma, struct md_ucred *uc)
+                        const struct md_attr *ma)
 {
         struct mdd_object *mdd_obj = md2mdd_obj(obj);
         struct mdd_device *mdd = mdo2mdd(obj);
@@ -1232,7 +1230,7 @@ static int mdd_attr_set(const struct lu_env *env, struct md_object *obj,
 
         *la_copy = ma->ma_attr;
         mdd_write_lock(env, mdd_obj);
-        rc = mdd_fix_attr(env, mdd_obj, la_copy, uc);
+        rc = mdd_fix_attr(env, mdd_obj, la_copy);
         mdd_write_unlock(env, mdd_obj);
         if (rc)
                 GOTO(cleanup, rc);
@@ -1290,10 +1288,10 @@ int mdd_xattr_set_txn(const struct lu_env *env, struct mdd_object *obj,
 }
 
 static int mdd_xattr_sanity_check(const struct lu_env *env,
-                                  struct mdd_object *obj,
-                                  struct md_ucred *uc)
+                                  struct mdd_object *obj)
 {
-        struct lu_attr *tmp_la = &mdd_env_info(env)->mti_la;
+        struct lu_attr  *tmp_la = &mdd_env_info(env)->mti_la;
+        struct md_ucred *uc     = md_ucred(env);
         int rc;
         ENTRY;
 
@@ -1313,8 +1311,7 @@ static int mdd_xattr_sanity_check(const struct lu_env *env,
 }
 
 static int mdd_xattr_set(const struct lu_env *env, struct md_object *obj,
-                         const struct lu_buf *buf, const char *name, int fl,
-                         struct md_ucred *uc)
+                         const struct lu_buf *buf, const char *name, int fl)
 {
         struct mdd_object *mdd_obj = md2mdd_obj(obj);
         struct mdd_device *mdd = mdo2mdd(obj);
@@ -1322,7 +1319,7 @@ static int mdd_xattr_set(const struct lu_env *env, struct md_object *obj,
         int  rc;
         ENTRY;
 
-        rc = mdd_xattr_sanity_check(env, mdd_obj, uc);
+        rc = mdd_xattr_sanity_check(env, mdd_obj);
         if (rc)
                 RETURN(rc);
 
@@ -1362,7 +1359,7 @@ static int __mdd_xattr_del(const struct lu_env *env,struct mdd_device *mdd,
 }
 
 int mdd_xattr_del(const struct lu_env *env, struct md_object *obj,
-                  const char *name, struct md_ucred *uc)
+                  const char *name)
 {
         struct mdd_object *mdd_obj = md2mdd_obj(obj);
         struct mdd_device *mdd = mdo2mdd(obj);
@@ -1370,7 +1367,7 @@ int mdd_xattr_del(const struct lu_env *env, struct md_object *obj,
         int  rc;
         ENTRY;
 
-        rc = mdd_xattr_sanity_check(env, mdd_obj, uc);
+        rc = mdd_xattr_sanity_check(env, mdd_obj);
         if (rc)
                 RETURN(rc);
 
@@ -1457,13 +1454,12 @@ static int __mdd_index_delete(const struct lu_env *env,
 
 static int mdd_link_sanity_check(const struct lu_env *env,
                                  struct mdd_object *tgt_obj,
-                                 struct mdd_object *src_obj,
-                                 struct md_ucred *uc)
+                                 struct mdd_object *src_obj)
 {
         int rc;
         ENTRY;
 
-        rc = mdd_may_create(env, tgt_obj, NULL, 1, uc);
+        rc = mdd_may_create(env, tgt_obj, NULL, 1);
         if (rc)
                 RETURN(rc);
 
@@ -1478,7 +1474,7 @@ static int mdd_link_sanity_check(const struct lu_env *env,
 
 static int mdd_link(const struct lu_env *env, struct md_object *tgt_obj,
                     struct md_object *src_obj, const char *name,
-                    struct md_attr *ma, struct md_ucred *uc)
+                    struct md_attr *ma)
 {
         struct mdd_object *mdd_tobj = md2mdd_obj(tgt_obj);
         struct mdd_object *mdd_sobj = md2mdd_obj(src_obj);
@@ -1495,7 +1491,7 @@ static int mdd_link(const struct lu_env *env, struct md_object *tgt_obj,
 
         mdd_lock2(env, mdd_tobj, mdd_sobj);
 
-        rc = mdd_link_sanity_check(env, mdd_tobj, mdd_sobj, uc);
+        rc = mdd_link_sanity_check(env, mdd_tobj, mdd_sobj);
         if (rc)
                 GOTO(out, rc);
 
@@ -1609,15 +1605,14 @@ static int __mdd_finish_unlink(const struct lu_env *env,
 static int mdd_unlink_sanity_check(const struct lu_env *env,
                                    struct mdd_object *pobj,
                                    struct mdd_object *cobj,
-                                   struct md_attr *ma,
-                                   struct md_ucred *uc)
+                                   struct md_attr *ma)
 {
         struct dt_object  *dt_cobj  = mdd_object_child(cobj);
         int rc = 0;
         ENTRY;
 
         rc = mdd_may_delete(env, pobj, cobj,
-                            S_ISDIR(ma->ma_attr.la_mode), 1, uc);
+                            S_ISDIR(ma->ma_attr.la_mode), 1);
         if (rc)
                 RETURN(rc);
 
@@ -1633,7 +1628,7 @@ static int mdd_unlink_sanity_check(const struct lu_env *env,
 
 static int mdd_unlink(const struct lu_env *env,
                       struct md_object *pobj, struct md_object *cobj,
-                      const char *name, struct md_attr *ma, struct md_ucred *uc)
+                      const char *name, struct md_attr *ma)
 {
         struct mdd_device *mdd = mdo2mdd(pobj);
         struct mdd_object *mdd_pobj = md2mdd_obj(pobj);
@@ -1650,7 +1645,7 @@ static int mdd_unlink(const struct lu_env *env,
 
         mdd_lock2(env, mdd_pobj, mdd_cobj);
 
-        rc = mdd_unlink_sanity_check(env, mdd_pobj, mdd_cobj, ma, uc);
+        rc = mdd_unlink_sanity_check(env, mdd_pobj, mdd_cobj, ma);
         if (rc)
                 GOTO(cleanup, rc);
 
@@ -1692,7 +1687,7 @@ cleanup:
 
 /* partial unlink */
 static int mdd_ref_del(const struct lu_env *env, struct md_object *obj,
-                       struct md_attr *ma, struct md_ucred *uc)
+                       struct md_attr *ma)
 {
         struct mdd_object *mdd_obj = md2mdd_obj(obj);
         struct mdd_device *mdd = mdo2mdd(obj);
@@ -1707,7 +1702,7 @@ static int mdd_ref_del(const struct lu_env *env, struct md_object *obj,
 
         mdd_write_lock(env, mdd_obj);
 
-        rc = mdd_unlink_sanity_check(env, NULL, mdd_obj, ma, uc);
+        rc = mdd_unlink_sanity_check(env, NULL, mdd_obj, ma);
         if (rc)
                 GOTO(cleanup, rc);
 
@@ -1732,7 +1727,7 @@ static int mdd_parent_fid(const struct lu_env *env,
                           struct lu_fid *fid)
 {
         return __mdd_lookup_locked(env, &obj->mod_obj,
-                                   dotdot, fid, 0, NULL);
+                                   dotdot, fid, 0);
 }
 
 /*
@@ -1841,15 +1836,14 @@ static int mdd_rename_sanity_check(const struct lu_env *env,
                                    const struct lu_fid *sfid,
                                    int src_is_dir,
                                    struct mdd_object *sobj,
-                                   struct mdd_object *tobj,
-                                   struct md_ucred *uc)
+                                   struct mdd_object *tobj)
 {
         struct mdd_device *mdd = mdo2mdd(&src_pobj->mod_obj);
         int rc = 0, need_check = 1;
         ENTRY;
 
         mdd_read_lock(env, src_pobj);
-        rc = mdd_may_delete(env, src_pobj, sobj, src_is_dir, need_check, uc);
+        rc = mdd_may_delete(env, src_pobj, sobj, src_is_dir, need_check);
         mdd_read_unlock(env, src_pobj);
         if (rc)
                 RETURN(rc);
@@ -1859,12 +1853,12 @@ static int mdd_rename_sanity_check(const struct lu_env *env,
 
         if (!tobj) {
                 mdd_read_lock(env, tgt_pobj);
-                rc = mdd_may_create(env, tgt_pobj, NULL, need_check, uc);
+                rc = mdd_may_create(env, tgt_pobj, NULL, need_check);
                 mdd_read_unlock(env, tgt_pobj);
         } else {
                 mdd_read_lock(env, tgt_pobj);
                 rc = mdd_may_delete(env, tgt_pobj, tobj, src_is_dir,
-                                    need_check, uc);
+                                    need_check);
                 mdd_read_unlock(env, tgt_pobj);
                 if (!rc && S_ISDIR(mdd_object_type(tobj)) &&
                     mdd_dir_is_empty(env, tobj))
@@ -1882,7 +1876,7 @@ static int mdd_rename(const struct lu_env *env,
                       struct md_object *src_pobj, struct md_object *tgt_pobj,
                       const struct lu_fid *lf, const char *sname,
                       struct md_object *tobj, const char *tname,
-                      struct md_attr *ma, struct md_ucred *uc)
+                      struct md_attr *ma)
 {
         struct mdd_device *mdd = mdo2mdd(src_pobj);
         struct mdd_object *mdd_spobj = md2mdd_obj(src_pobj);
@@ -1906,7 +1900,7 @@ static int mdd_rename(const struct lu_env *env,
 
         /*XXX: shouldn't this check be done under lock below? */
         rc = mdd_rename_sanity_check(env, mdd_spobj, mdd_tpobj,
-                                     lf, is_dir, mdd_sobj, mdd_tobj, uc);
+                                     lf, is_dir, mdd_sobj, mdd_tobj);
         if (rc)
                 GOTO(out, rc);
 
@@ -1986,8 +1980,7 @@ out:
 
 static int
 __mdd_lookup(const struct lu_env *env, struct md_object *pobj,
-             const char *name, const struct lu_fid* fid, int mask,
-             struct md_ucred *uc)
+             const char *name, const struct lu_fid* fid, int mask)
 {
         struct mdd_object   *mdd_obj = md2mdd_obj(pobj);
         struct dt_object    *dir = mdd_object_child(mdd_obj);
@@ -2000,9 +1993,9 @@ __mdd_lookup(const struct lu_env *env, struct md_object *pobj,
                 RETURN(-ESTALE);
 
         if (mask == MAY_EXEC)
-                rc = mdd_exec_permission_lite(env, mdd_obj, uc);
+                rc = mdd_exec_permission_lite(env, mdd_obj);
         else
-                rc = mdd_permission_internal(env, mdd_obj, mask, uc);
+                rc = mdd_permission_internal(env, mdd_obj, mask);
         if (rc)
                 RETURN(rc);
 
@@ -2016,14 +2009,13 @@ __mdd_lookup(const struct lu_env *env, struct md_object *pobj,
 
 static int
 __mdd_lookup_locked(const struct lu_env *env, struct md_object *pobj,
-                    const char *name, const struct lu_fid* fid, int mask,
-                    struct md_ucred *uc)
+                    const char *name, const struct lu_fid* fid, int mask)
 {
         struct mdd_object *mdd_obj = md2mdd_obj(pobj);
         int rc;
 
         mdd_read_lock(env, mdd_obj);
-        rc = __mdd_lookup(env, pobj, name, fid, mask, uc);
+        rc = __mdd_lookup(env, pobj, name, fid, mask);
         mdd_read_unlock(env, mdd_obj);
 
        return rc;
@@ -2031,11 +2023,11 @@ __mdd_lookup_locked(const struct lu_env *env, struct md_object *pobj,
 
 static int mdd_lookup(const struct lu_env *env,
                       struct md_object *pobj, const char *name,
-                      struct lu_fid* fid, struct md_ucred *uc)
+                      struct lu_fid* fid)
 {
         int rc;
         ENTRY;
-        rc = __mdd_lookup_locked(env, pobj, name, fid, MAY_EXEC, uc);
+        rc = __mdd_lookup_locked(env, pobj, name, fid, MAY_EXEC);
         RETURN(rc);
 }
 
@@ -2050,7 +2042,7 @@ static int mdd_lookup(const struct lu_env *env,
  */
 static int mdd_is_subdir(const struct lu_env *env,
                          struct md_object *mo, const struct lu_fid *fid,
-                         struct lu_fid *sfid, struct md_ucred *uc)
+                         struct lu_fid *sfid)
 {
         struct mdd_device *mdd = mdo2mdd(mo);
         int rc;
@@ -2110,7 +2102,7 @@ static int __mdd_object_initialize(const struct lu_env *env,
  * XXX: Need MAY_WRITE to be checked?
  */
 static int mdd_cd_sanity_check(const struct lu_env *env,
-                               struct mdd_object *obj, struct md_ucred *uc)
+                               struct mdd_object *obj)
 {
         int rc = 0;
         ENTRY;
@@ -2121,7 +2113,7 @@ static int mdd_cd_sanity_check(const struct lu_env *env,
 
 #if 0
         mdd_read_lock(env, obj);
-        rc = mdd_permission_internal(env, obj, MAY_WRITE, uc);
+        rc = mdd_permission_internal(env, obj, MAY_WRITE);
         mdd_read_unlock(env, obj);
 #endif
 
@@ -2132,7 +2124,7 @@ static int mdd_cd_sanity_check(const struct lu_env *env,
 static int mdd_create_data(const struct lu_env *env,
                            struct md_object *pobj, struct md_object *cobj,
                            const struct md_create_spec *spec,
-                           struct md_attr *ma, struct md_ucred *uc)
+                           struct md_attr *ma)
 {
         struct mdd_device *mdd = mdo2mdd(cobj);
         struct mdd_object *mdd_pobj = md2mdd_obj(pobj);/* XXX maybe NULL */
@@ -2144,7 +2136,7 @@ static int mdd_create_data(const struct lu_env *env,
         int                rc;
         ENTRY;
 
-        rc = mdd_cd_sanity_check(env, son, uc);
+        rc = mdd_cd_sanity_check(env, son);
         if (rc)
                 RETURN(rc);
 
@@ -2187,8 +2179,7 @@ static int mdd_create_data(const struct lu_env *env,
 
 static int mdd_create_sanity_check(const struct lu_env *env,
                                    struct md_object *pobj,
-                                   const char *name, struct md_attr *ma,
-                                   struct md_ucred *uc)
+                                   const char *name, struct md_attr *ma)
 {
         struct mdd_thread_info *info = mdd_env_info(env);
         struct lu_attr    *la        = &info->mti_la;
@@ -2202,7 +2193,7 @@ static int mdd_create_sanity_check(const struct lu_env *env,
                 RETURN(-ENOENT);
 
         rc = __mdd_lookup_locked(env, pobj, name, fid,
-                                 MAY_WRITE | MAY_EXEC, uc);
+                                 MAY_WRITE | MAY_EXEC);
         if (rc != -ENOENT)
                 RETURN(rc ? : -EEXIST);
 
@@ -2245,7 +2236,7 @@ static int mdd_create(const struct lu_env *env,
                       struct md_object *pobj, const char *name,
                       struct md_object *child,
                       const struct md_create_spec *spec,
-                      struct md_attr* ma, struct md_ucred *uc)
+                      struct md_attr* ma)
 {
         struct mdd_device *mdd = mdo2mdd(pobj);
         struct mdd_object *mdd_pobj = md2mdd_obj(pobj);
@@ -2258,7 +2249,7 @@ static int mdd_create(const struct lu_env *env,
         ENTRY;
 
         /* sanity checks before big job */
-        rc = mdd_create_sanity_check(env, pobj, name, ma, uc);
+        rc = mdd_create_sanity_check(env, pobj, name, ma);
         if (rc)
                 RETURN(rc);
 
@@ -2410,8 +2401,7 @@ cleanup:
 /* partial operation */
 static int mdd_oc_sanity_check(const struct lu_env *env,
                                struct mdd_object *obj,
-                               struct md_attr *ma,
-                               struct md_ucred *uc)
+                               struct md_attr *ma)
 {
         int rc;
         ENTRY;
@@ -2440,8 +2430,7 @@ static int mdd_oc_sanity_check(const struct lu_env *env,
 static int mdd_object_create(const struct lu_env *env,
                              struct md_object *obj,
                              const struct md_create_spec *spec,
-                             struct md_attr *ma,
-                             struct md_ucred *uc)
+                             struct md_attr *ma)
 {
 
         struct mdd_device *mdd = mdo2mdd(obj);
@@ -2451,7 +2440,7 @@ static int mdd_object_create(const struct lu_env *env,
         int rc;
         ENTRY;
 
-        rc = mdd_oc_sanity_check(env, mdd_obj, ma, uc);
+        rc = mdd_oc_sanity_check(env, mdd_obj, ma);
         if (rc)
                 RETURN(rc);
 
@@ -2492,8 +2481,7 @@ static int mdd_object_create(const struct lu_env *env,
 static int mdd_ni_sanity_check(const struct lu_env *env,
                                struct md_object *pobj,
                                const char *name,
-                               const struct lu_fid *fid,
-                               struct md_ucred *uc)
+                               const struct lu_fid *fid)
 {
         struct mdd_object *obj       = md2mdd_obj(pobj);
         int rc;
@@ -2503,7 +2491,7 @@ static int mdd_ni_sanity_check(const struct lu_env *env,
         if (mdd_is_dead_obj(obj))
                 RETURN(-ENOENT);
 
-        rc = __mdd_lookup(env, pobj, name, fid, MAY_WRITE | MAY_EXEC, uc);
+        rc = __mdd_lookup(env, pobj, name, fid, MAY_WRITE | MAY_EXEC);
         if (rc != -ENOENT)
                 RETURN(rc ? : -EEXIST);
         else
@@ -2513,7 +2501,7 @@ static int mdd_ni_sanity_check(const struct lu_env *env,
 static int mdd_name_insert(const struct lu_env *env,
                            struct md_object *pobj,
                            const char *name, const struct lu_fid *fid,
-                           int isdir, struct md_ucred *uc)
+                           int isdir)
 {
         struct mdd_object *mdd_obj = md2mdd_obj(pobj);
         struct thandle *handle;
@@ -2526,7 +2514,7 @@ static int mdd_name_insert(const struct lu_env *env,
                 RETURN(PTR_ERR(handle));
 
         mdd_write_lock(env, mdd_obj);
-        rc = mdd_ni_sanity_check(env, pobj, name, fid, uc);
+        rc = mdd_ni_sanity_check(env, pobj, name, fid);
         if (rc)
                 GOTO(out_unlock, rc);
 
@@ -2545,8 +2533,7 @@ out_unlock:
  */
 static int mdd_nr_sanity_check(const struct lu_env *env,
                                struct md_object *pobj,
-                               const char *name,
-                               struct md_ucred *uc)
+                               const char *name)
 {
         struct mdd_thread_info *info = mdd_env_info(env);
         struct lu_fid     *fid       = &info->mti_fid;
@@ -2558,14 +2545,13 @@ static int mdd_nr_sanity_check(const struct lu_env *env,
         if (mdd_is_dead_obj(obj))
                 RETURN(-ENOENT);
 
-        rc = __mdd_lookup(env, pobj, name, fid, MAY_WRITE | MAY_EXEC, uc);
+        rc = __mdd_lookup(env, pobj, name, fid, MAY_WRITE | MAY_EXEC);
         RETURN(rc);
 }
 
 static int mdd_name_remove(const struct lu_env *env,
                            struct md_object *pobj,
-                           const char *name,
-                           struct md_ucred *uc)
+                           const char *name)
 {
         struct mdd_device *mdd = mdo2mdd(pobj);
         struct mdd_object *mdd_obj = md2mdd_obj(pobj);
@@ -2579,7 +2565,7 @@ static int mdd_name_remove(const struct lu_env *env,
                 RETURN(PTR_ERR(handle));
 
         mdd_write_lock(env, mdd_obj);
-        rc = mdd_nr_sanity_check(env, pobj, name, uc);
+        rc = mdd_nr_sanity_check(env, pobj, name);
         if (rc)
                 GOTO(out_unlock, rc);
 
@@ -2596,8 +2582,7 @@ static int mdd_rt_sanity_check(const struct lu_env *env,
                                struct mdd_object *tgt_pobj,
                                struct mdd_object *tobj,
                                const struct lu_fid *sfid,
-                               const char *name, struct md_attr *ma,
-                               struct md_ucred *uc)
+                               const char *name, struct md_attr *ma)
 {
         struct mdd_device *mdd = mdo2mdd(&tgt_pobj->mod_obj);
         int rc, src_is_dir;
@@ -2609,12 +2594,12 @@ static int mdd_rt_sanity_check(const struct lu_env *env,
 
         src_is_dir = S_ISDIR(ma->ma_attr.la_mode);
         if (tobj) {
-                rc = mdd_may_delete(env, tgt_pobj, tobj, src_is_dir, 1, uc);
+                rc = mdd_may_delete(env, tgt_pobj, tobj, src_is_dir, 1);
                 if (!rc && S_ISDIR(mdd_object_type(tobj)) &&
                      mdd_dir_is_empty(env, tobj))
                                 RETURN(-ENOTEMPTY);
         } else {
-                rc = mdd_may_create(env, tgt_pobj, NULL, 1, uc);
+                rc = mdd_may_create(env, tgt_pobj, NULL, 1);
         }
 
         /* source should not be ancestor of target dir */
@@ -2627,7 +2612,7 @@ static int mdd_rt_sanity_check(const struct lu_env *env,
 static int mdd_rename_tgt(const struct lu_env *env,
                           struct md_object *pobj, struct md_object *tobj,
                           const struct lu_fid *lf, const char *name,
-                          struct md_attr *ma, struct md_ucred *uc)
+                          struct md_attr *ma)
 {
         struct mdd_device *mdd = mdo2mdd(pobj);
         struct mdd_object *mdd_tpobj = md2mdd_obj(pobj);
@@ -2649,7 +2634,7 @@ static int mdd_rename_tgt(const struct lu_env *env,
         }
 
         /*TODO rename sanity checking*/
-        rc = mdd_rt_sanity_check(env, mdd_tpobj, mdd_tobj, lf, name, ma, uc);
+        rc = mdd_rt_sanity_check(env, mdd_tpobj, mdd_tobj, lf, name, ma);
         if (rc)
                 GOTO(cleanup, rc);
 
@@ -2678,8 +2663,7 @@ cleanup:
  * No permission check is needed.
  */
 static int mdd_root_get(const struct lu_env *env,
-                        struct md_device *m, struct lu_fid *f,
-                        struct md_ucred *uc)
+                        struct md_device *m, struct lu_fid *f)
 {
         struct mdd_device *mdd = lu2mdd_dev(&m->md_lu_dev);
 
@@ -2692,7 +2676,7 @@ static int mdd_root_get(const struct lu_env *env,
  * No permission check is needed.
  */
 static int mdd_statfs(const struct lu_env *env, struct md_device *m,
-                      struct kstatfs *sfs, struct md_ucred *uc)
+                      struct kstatfs *sfs)
 {
        struct mdd_device *mdd = lu2mdd_dev(&m->md_lu_dev);
         int rc;
@@ -2708,7 +2692,7 @@ static int mdd_statfs(const struct lu_env *env, struct md_device *m,
  * No permission check is needed.
  */
 static int mdd_maxsize_get(const struct lu_env *env, struct md_device *m,
-                           int *md_size, int *cookie_size, struct md_ucred *uc)
+                           int *md_size, int *cookie_size)
 {
        struct mdd_device *mdd = lu2mdd_dev(&m->md_lu_dev);
         ENTRY;
@@ -2758,7 +2742,7 @@ static void __mdd_ref_add(const struct lu_env *env, struct mdd_object *obj,
  * XXX: if permission check is needed here?
  */
 static int mdd_ref_add(const struct lu_env *env,
-                       struct md_object *obj, struct md_ucred *uc)
+                       struct md_object *obj)
 {
         struct mdd_object *mdd_obj = md2mdd_obj(obj);
         struct mdd_device *mdd = mdo2mdd(obj);
@@ -2814,8 +2798,7 @@ static int accmode(struct mdd_object *mdd_obj, int flags)
 }
 
 static int mdd_open_sanity_check(const struct lu_env *env,
-                                 struct mdd_object *obj, int flag,
-                                 struct md_ucred *uc)
+                                 struct mdd_object *obj, int flag)
 {
         struct lu_attr *tmp_la = &mdd_env_info(env)->mti_la;
         int mode = accmode(obj, flag);
@@ -2837,7 +2820,7 @@ static int mdd_open_sanity_check(const struct lu_env *env,
                 RETURN(-EISDIR);
 
         if (!(flag & MDS_OPEN_CREATED)) {
-                rc = __mdd_permission_internal(env, obj, mode, 0, uc);
+                rc = __mdd_permission_internal(env, obj, mode, 0);
                 if (rc)
                         RETURN(rc);
         }
@@ -2862,22 +2845,26 @@ static int mdd_open_sanity_check(const struct lu_env *env,
         }
 
         /* O_NOATIME can only be set by the owner or superuser */
-        if (flag & O_NOATIME)
-                if (uc->mu_fsuid != tmp_la->la_uid && !mdd_capable(uc, CAP_FOWNER))
+        if (flag & O_NOATIME) {
+                struct md_ucred *uc = md_ucred(env);
+
+                if (uc->mu_fsuid != tmp_la->la_uid &&
+                    !mdd_capable(uc, CAP_FOWNER))
                         RETURN(-EPERM);
+        }
 
         RETURN(0);
 }
 
 static int mdd_open(const struct lu_env *env, struct md_object *obj,
-                    int flags, struct md_ucred *uc)
+                    int flags)
 {
         struct mdd_object *mdd_obj = md2mdd_obj(obj);
         int rc = 0;
 
         mdd_write_lock(env, mdd_obj);
 
-        rc = mdd_open_sanity_check(env, mdd_obj, flags, uc);
+        rc = mdd_open_sanity_check(env, mdd_obj, flags);
         if (rc == 0)
                 mdd_obj->mod_count ++;
 
@@ -2889,7 +2876,7 @@ static int mdd_open(const struct lu_env *env, struct md_object *obj,
  * No permission check is needed.
  */
 static int mdd_close(const struct lu_env *env, struct md_object *obj,
-                     struct md_attr *ma, struct md_ucred *uc)
+                     struct md_attr *ma)
 {
         int rc;
         struct mdd_object *mdd_obj = md2mdd_obj(obj);
@@ -2909,8 +2896,7 @@ static int mdd_close(const struct lu_env *env, struct md_object *obj,
 }
 
 static int mdd_readpage_sanity_check(const struct lu_env *env,
-                                     struct mdd_object *obj,
-                                     struct md_ucred *uc)
+                                     struct mdd_object *obj)
 {
         struct dt_object *next = mdd_object_child(obj);
         int rc;
@@ -2918,7 +2904,7 @@ static int mdd_readpage_sanity_check(const struct lu_env *env,
 
         if (S_ISDIR(mdd_object_type(obj)) &&
             dt_try_as_dir(env, next))
-                rc = mdd_permission_internal(env, obj, MAY_READ, uc);
+                rc = mdd_permission_internal(env, obj, MAY_READ);
         else
                 rc = -ENOTDIR;
 
@@ -2926,7 +2912,7 @@ static int mdd_readpage_sanity_check(const struct lu_env *env,
 }
 
 static int mdd_readpage(const struct lu_env *env, struct md_object *obj,
-                        const struct lu_rdpg *rdpg, struct md_ucred *uc)
+                        const struct lu_rdpg *rdpg)
 {
         struct dt_object *next;
         struct mdd_object *mdd_obj = md2mdd_obj(obj);
@@ -2937,7 +2923,7 @@ static int mdd_readpage(const struct lu_env *env, struct md_object *obj,
         next = mdd_object_child(mdd_obj);
 
         mdd_read_lock(env, mdd_obj);
-        rc = mdd_readpage_sanity_check(env, mdd_obj, uc);
+        rc = mdd_readpage_sanity_check(env, mdd_obj);
         if (rc)
                 GOTO(out_unlock, rc);
 
@@ -3022,11 +3008,12 @@ check_perm:
 #endif
 
 static int mdd_check_acl(const struct lu_env *env, struct mdd_object *obj,
-                         struct lu_attr* la, int mask, struct md_ucred *uc)
+                         struct lu_attr* la, int mask)
 {
 #ifdef CONFIG_FS_POSIX_ACL
         struct dt_object *next;
         struct lu_buf    *buf = &mdd_env_info(env)->mti_buf;
+        struct md_ucred  *uc  = md_ucred(env);
         posix_acl_xattr_entry *entry;
         int entry_count;
         int rc;
@@ -3060,10 +3047,10 @@ out:
 }
 
 static int mdd_exec_permission_lite(const struct lu_env *env,
-                                    struct mdd_object *obj,
-                                    struct md_ucred *uc)
+                                    struct mdd_object *obj)
 {
-        struct lu_attr *la = &mdd_env_info(env)->mti_la;
+        struct lu_attr  *la = &mdd_env_info(env)->mti_la;
+        struct md_ucred *uc = md_ucred(env);
         umode_t mode;
         int rc;
         ENTRY;
@@ -3101,10 +3088,10 @@ static int mdd_exec_permission_lite(const struct lu_env *env,
 
 static int __mdd_permission_internal(const struct lu_env *env,
                                      struct mdd_object *obj,
-                                     int mask, int getattr,
-                                     struct md_ucred *uc)
+                                     int mask, int getattr)
 {
-        struct lu_attr *la = &mdd_env_info(env)->mti_la;
+        struct lu_attr  *la = &mdd_env_info(env)->mti_la;
+        struct md_ucred *uc = md_ucred(env);
         __u32 mode;
         int rc;
 
@@ -3141,7 +3128,7 @@ static int __mdd_permission_internal(const struct lu_env *env,
                         if (((mode >> 3) & mask & S_IRWXO) != mask)
                                 goto check_groups;
 
-                        rc = mdd_check_acl(env, obj, la, mask, uc);
+                        rc = mdd_check_acl(env, obj, la, mask);
                         if (rc == -EACCES)
                                 goto check_capabilities;
                         else if ((rc != -EAGAIN) && (rc != -EOPNOTSUPP))
@@ -3184,25 +3171,25 @@ check_capabilities:
 
 static inline int mdd_permission_internal_locked(const struct lu_env *env,
                                                  struct mdd_object *obj,
-                                                 int mask, struct md_ucred *uc)
+                                                 int mask)
 {
         int rc;
 
         mdd_read_lock(env, obj);
-        rc = mdd_permission_internal(env, obj, mask, uc);
+        rc = mdd_permission_internal(env, obj, mask);
         mdd_read_unlock(env, obj);
 
         return rc;
 }
 
 static int mdd_permission(const struct lu_env *env, struct md_object *obj,
-                          int mask, struct md_ucred *uc)
+                          int mask)
 {
         struct mdd_object *mdd_obj = md2mdd_obj(obj);
         int rc;
         ENTRY;
 
-        rc = mdd_permission_internal_locked(env, mdd_obj, mask, uc);
+        rc = mdd_permission_internal_locked(env, mdd_obj, mask);
 
         RETURN(rc);
 }
@@ -3319,13 +3306,50 @@ static void mdd_device_free(const struct lu_env *env,
         OBD_FREE_PTR(m);
 }
 
+static void *mdd_ucred_key_init(const struct lu_context *ctx,
+                                struct lu_context_key *key)
+{
+        struct md_ucred *uc;
+
+        OBD_ALLOC_PTR(uc);
+        if (uc == NULL)
+                uc = ERR_PTR(-ENOMEM);
+        return uc;
+}
+
+static void mdd_ucred_key_fini(const struct lu_context *ctx,
+                             struct lu_context_key *key, void *data)
+{
+        struct md_ucred *uc = data;
+        OBD_FREE_PTR(uc);
+}
+
+static struct lu_context_key mdd_ucred_key = {
+        .lct_tags = LCT_SESSION,
+        .lct_init = mdd_ucred_key_init,
+        .lct_fini = mdd_ucred_key_fini
+};
+
+struct md_ucred *md_ucred(const struct lu_env *env)
+{
+        LASSERT(env->le_ses != NULL);
+        return lu_context_key_get(env->le_ses, &mdd_ucred_key);
+}
+EXPORT_SYMBOL(md_ucred);
+
 static int mdd_type_init(struct lu_device_type *t)
 {
-        return lu_context_key_register(&mdd_thread_key);
+        int result;
+
+        result = lu_context_key_register(&mdd_thread_key);
+        if (result == 0)
+                result = lu_context_key_register(&mdd_ucred_key);
+        return result;
 }
 
 static void mdd_type_fini(struct lu_device_type *t)
 {
+        lu_context_key_degister(&mdd_ucred_key);
         lu_context_key_degister(&mdd_thread_key);
 }
 
index 5390d52..a0c1e96 100644 (file)
@@ -168,7 +168,7 @@ static int mdt_getstatus(struct mdt_thread_info *info)
         } else {
                 body = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY);
                 rc = next->md_ops->mdo_root_get(info->mti_env, next,
-                                                &body->fid1, NULL);
+                                                &body->fid1);
                 if (rc == 0)
                         body->valid |= OBD_MD_FLID;
         }
@@ -195,7 +195,7 @@ static int mdt_statfs(struct mdt_thread_info *info)
                 osfs = req_capsule_server_get(&info->mti_pill,&RMF_OBD_STATFS);
                 /* XXX max_age optimisation is needed here. See mds_statfs */
                 rc = next->md_ops->mdo_statfs(info->mti_env, next,
-                                              &info->mti_u.ksfs, NULL);
+                                              &info->mti_u.ksfs);
                 statfs_pack(osfs, &info->mti_u.ksfs);
         }
 
@@ -287,7 +287,7 @@ static int mdt_getattr_internal(struct mdt_thread_info *info,
                 ma->ma_lmm_size = req_capsule_get_size(pill, &RMF_MDT_MD,
                                                              RCL_SERVER);
         }
-        rc = mo_attr_get(env, next, ma, NULL);
+        rc = mo_attr_get(env, next, ma);
         if (rc == -EREMOTE) {
                 /* This object is located on remote node.*/
                 repbody->fid1 = *mdt_object_fid(o);
@@ -326,7 +326,7 @@ static int mdt_getattr_internal(struct mdt_thread_info *info,
                           reqbody->valid & OBD_MD_LINKNAME) {
                 buffer->lb_buf = ma->ma_lmm;
                 buffer->lb_len = ma->ma_lmm_size;
-                rc = mo_readlink(env, next, buffer, NULL);
+                rc = mo_readlink(env, next, buffer);
                 if (rc <= 0) {
                         CERROR("readlink failed: %d\n", rc);
                         rc = -EFAULT;
@@ -367,7 +367,7 @@ static int mdt_getattr_internal(struct mdt_thread_info *info,
                                                       &RMF_ACL, RCL_SERVER);
                 if (buffer->lb_len > 0) {
                         rc = mo_xattr_get(env, next, buffer,
-                                          XATTR_NAME_ACL_ACCESS, NULL);
+                                          XATTR_NAME_ACL_ACCESS);
                         if (rc < 0) {
                                 if (rc == -ENODATA || rc == -EOPNOTSUPP)
                                         rc = 0;
@@ -448,7 +448,7 @@ static int mdt_is_subdir(struct mdt_thread_info *info)
          */
         LASSERT(fid_is_sane(&info->mti_body->fid2));
         rc = mdo_is_subdir(info->mti_env, mdt_object_child(obj),
-                           &info->mti_body->fid2, &repbody->fid1, NULL);
+                           &info->mti_body->fid2, &repbody->fid1);
         if (rc < 0)
                 RETURN(rc);
 
@@ -549,7 +549,7 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
                 RETURN(rc);
 
         /*step 2: lookup child's fid by name */
-        rc = mdo_lookup(info->mti_env, next, name, child_fid, &info->mti_uc);
+        rc = mdo_lookup(info->mti_env, next, name, child_fid);
         if (rc != 0) {
                 if (rc == -ENOENT)
                         mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_NEG);
@@ -931,8 +931,7 @@ static int mdt_readpage(struct mdt_thread_info *info)
         }
 
         /* call lower layers to fill allocated pages with directory data */
-        rc = mo_readpage(info->mti_env, mdt_object_child(object), rdpg,
-                         &info->mti_uc);
+        rc = mo_readpage(info->mti_env, mdt_object_child(object), rdpg);
         if (rc) {
                 if (rc == -ERANGE)
                         rc1 = rc;
@@ -1123,7 +1122,7 @@ static int mdt_sync(struct mdt_thread_info *info)
                                 next = mdt_object_child(info->mti_object);
                                 info->mti_attr.ma_need = MA_INODE;
                                 rc = mo_attr_get(info->mti_env, next,
-                                                 &info->mti_attr, NULL);
+                                                 &info->mti_attr);
                                 if (rc == 0) {
                                         body = req_capsule_server_get(pill,
                                                                 &RMF_MDT_BODY);
@@ -3768,7 +3767,7 @@ static int mdt_upcall(const struct lu_env *env, struct md_device *md,
                 case MD_LOV_SYNC:
                         rc = next->md_ops->mdo_maxsize_get(env, next,
                                         &m->mdt_max_mdsize,
-                                        &m->mdt_max_cookiesize, NULL);
+                                        &m->mdt_max_cookiesize);
                         CDEBUG(D_INFO, "get max mdsize %d max cookiesize %d\n",
                                      m->mdt_max_mdsize, m->mdt_max_cookiesize);
                         break;
@@ -3958,6 +3957,10 @@ struct lu_context_key mdt_txn_key = {
         .lct_fini = mdt_txn_key_fini
 };
 
+struct md_ucred *mdt_ucred(const struct mdt_thread_info *info)
+{
+        return md_ucred(info->mti_env);
+}
 
 static int mdt_type_init(struct lu_device_type *t)
 {
index 90455b1..399b0b2 100644 (file)
@@ -227,7 +227,7 @@ int mdt_pack_remote_perm(struct mdt_thread_info *info, struct mdt_object *o,
                          void *buf)
 {
         struct ptlrpc_request   *req = mdt_info_req(info);
-        struct md_ucred         *uc = &info->mti_uc;
+        struct md_ucred         *uc = mdt_ucred(info);
         struct md_object        *next = mdt_object_child(o);
         struct mdt_export_data  *med = mdt_req2med(req);
         struct mdt_remote_perm  *perm = buf;
@@ -249,11 +249,11 @@ int mdt_pack_remote_perm(struct mdt_thread_info *info, struct mdt_object *o,
         perm->rp_fsgid = uc->mu_o_fsgid;
 
         perm->rp_access_perm = 0;
-        if (mo_permission(info->mti_env, next, MAY_READ, uc) == 0)
+        if (mo_permission(info->mti_env, next, MAY_READ) == 0)
                 perm->rp_access_perm |= MAY_READ;
-        if (mo_permission(info->mti_env, next, MAY_WRITE, uc) == 0)
+        if (mo_permission(info->mti_env, next, MAY_WRITE) == 0)
                 perm->rp_access_perm |= MAY_WRITE;
-        if (mo_permission(info->mti_env, next, MAY_EXEC, uc) == 0)
+        if (mo_permission(info->mti_env, next, MAY_EXEC) == 0)
                 perm->rp_access_perm |= MAY_EXEC;
 
         RETURN(0);
index 1103dc0..af8686d 100644 (file)
@@ -558,7 +558,7 @@ int ptlrpc_user_desc_do_idmap(struct ptlrpc_request *req,
 void mdt_body_reverse_idmap(struct mdt_thread_info *info, struct mdt_body *body)
 {
         struct ptlrpc_request   *req = mdt_info_req(info);
-        struct md_ucred         *uc = &info->mti_uc;
+        struct md_ucred         *uc = mdt_ucred(info);
         struct mdt_export_data  *med = mdt_req2med(req);
         struct mdt_idmap_table  *idmap = med->med_idmap;
         uid_t uid;
@@ -663,7 +663,7 @@ int mdt_remote_perm_reverse_idmap(struct ptlrpc_request *req,
 int mdt_fix_attr_ucred(struct mdt_thread_info *info, __u32 op)
 {
         struct ptlrpc_request   *req = mdt_info_req(info);
-        struct md_ucred         *uc = &info->mti_uc;
+        struct md_ucred         *uc = mdt_ucred(info);
         struct lu_attr          *attr = &info->mti_attr.ma_attr;
         struct mdt_export_data  *med = mdt_req2med(req);
         struct mdt_idmap_table  *idmap = med->med_idmap;
index d04fc64..50c5d3c 100644 (file)
@@ -266,10 +266,6 @@ struct mdt_thread_info {
          */
         struct mdt_object         *mti_object;
         /*
-         * User credential.
-         */
-        struct md_ucred            mti_uc;
-        /*
          * Object attributes.
          */
         struct md_attr             mti_attr;
@@ -578,6 +574,8 @@ do {                                                                         \
         }                                                                    \
 } while(0)
 
+struct md_ucred *mdt_ucred(const struct mdt_thread_info *info);
+
 /*
  * fid Capability
  */
index ac70d42..ff85060 100644 (file)
@@ -97,7 +97,7 @@ void groups_sort(struct group_info *group_info)
 
 void mdt_exit_ucred(struct mdt_thread_info *info)
 {
-        struct md_ucred   *uc = &info->mti_uc;
+        struct md_ucred   *uc  = mdt_ucred(info);
         struct mdt_device *mdt = info->mti_mdt;
 
         if (uc->mu_valid != UCRED_INIT) {
@@ -118,7 +118,7 @@ void mdt_exit_ucred(struct mdt_thread_info *info)
 static int old_init_ucred(struct mdt_thread_info *info,
                           struct mdt_body *body)
 {
-        struct md_ucred     *uc = &info->mti_uc;
+        struct md_ucred     *uc  = mdt_ucred(info);
         struct mdt_device   *mdt = info->mti_mdt;
         struct mdt_identity *identity = NULL;
 
@@ -153,7 +153,7 @@ static int old_init_ucred(struct mdt_thread_info *info,
 
 static int old_init_ucred_reint(struct mdt_thread_info *info)
 {
-        struct md_ucred     *uc = &info->mti_uc;
+        struct md_ucred     *uc  = mdt_ucred(info);
         struct mdt_device   *mdt = info->mti_mdt;
         struct mdt_identity *identity = NULL;
 
@@ -277,7 +277,7 @@ static int new_init_ucred(struct mdt_thread_info *info, ucred_init_type_t type,
         struct mdt_export_data  *med = mdt_req2med(req);
         struct mdt_device       *mdt = info->mti_mdt;
         struct ptlrpc_user_desc *pud = req->rq_user_desc;
-        struct md_ucred         *ucred = &info->mti_uc;
+        struct md_ucred         *ucred = mdt_ucred(info);
         struct mdt_identity     *identity = NULL;
         lnet_nid_t              peernid = req->rq_peer.nid;
         __u32                   setxid_perm = 0;
@@ -438,7 +438,7 @@ out:
 int mdt_init_ucred(struct mdt_thread_info *info, struct mdt_body *body)
 {
         struct ptlrpc_request *req = mdt_info_req(info);
-        struct md_ucred       *uc = &info->mti_uc;
+        struct md_ucred       *uc  = mdt_ucred(info);
 
         if ((uc->mu_valid == UCRED_OLD) || (uc->mu_valid == UCRED_NEW))
                 return 0;
@@ -453,7 +453,7 @@ int mdt_init_ucred(struct mdt_thread_info *info, struct mdt_body *body)
 int mdt_init_ucred_reint(struct mdt_thread_info *info)
 {
         struct ptlrpc_request *req = mdt_info_req(info);
-        struct md_ucred       *uc = &info->mti_uc;
+        struct md_ucred       *uc  = mdt_ucred(info);
 
         if ((uc->mu_valid == UCRED_OLD) || (uc->mu_valid == UCRED_NEW))
                 return 0;
@@ -601,7 +601,7 @@ static __u64 mdt_attr_valid_xlate(__u64 in, struct mdt_reint_record *rr,
 
 static int mdt_setattr_unpack_rec(struct mdt_thread_info *info)
 {
-        struct md_ucred         *uc = &info->mti_uc;
+        struct md_ucred         *uc  = mdt_ucred(info);
         struct md_attr          *ma = &info->mti_attr;
         struct lu_attr          *la = &ma->ma_attr;
         struct req_capsule      *pill = &info->mti_pill;
@@ -702,7 +702,7 @@ int mdt_close_unpack(struct mdt_thread_info *info)
 
 static int mdt_create_unpack(struct mdt_thread_info *info)
 {
-        struct md_ucred         *uc = &info->mti_uc;
+        struct md_ucred         *uc  = mdt_ucred(info);
         struct mdt_rec_create   *rec;
         struct lu_attr          *attr = &info->mti_attr.ma_attr;
         struct mdt_reint_record *rr = &info->mti_rr;
@@ -771,7 +771,7 @@ static int mdt_create_unpack(struct mdt_thread_info *info)
 
 static int mdt_link_unpack(struct mdt_thread_info *info)
 {
-        struct md_ucred         *uc = &info->mti_uc;
+        struct md_ucred         *uc  = mdt_ucred(info);
         struct mdt_rec_link     *rec;
         struct lu_attr          *attr = &info->mti_attr.ma_attr;
         struct mdt_reint_record *rr = &info->mti_rr;
@@ -810,7 +810,7 @@ static int mdt_link_unpack(struct mdt_thread_info *info)
 
 static int mdt_unlink_unpack(struct mdt_thread_info *info)
 {
-        struct md_ucred         *uc = &info->mti_uc;
+        struct md_ucred         *uc  = mdt_ucred(info);
         struct mdt_rec_unlink   *rec;
         struct lu_attr          *attr = &info->mti_attr.ma_attr;
         struct mdt_reint_record *rr = &info->mti_rr;
@@ -848,7 +848,7 @@ static int mdt_unlink_unpack(struct mdt_thread_info *info)
 
 static int mdt_rename_unpack(struct mdt_thread_info *info)
 {
-        struct md_ucred         *uc = &info->mti_uc;
+        struct md_ucred         *uc = mdt_ucred(info);
         struct mdt_rec_rename   *rec;
         struct lu_attr          *attr = &info->mti_attr.ma_attr;
         struct mdt_reint_record *rr = &info->mti_rr;
@@ -890,7 +890,7 @@ static int mdt_rename_unpack(struct mdt_thread_info *info)
 
 static int mdt_open_unpack(struct mdt_thread_info *info)
 {
-        struct md_ucred         *uc = &info->mti_uc;
+        struct md_ucred         *uc = mdt_ucred(info);
         struct mdt_rec_create   *rec;
         struct lu_attr          *attr = &info->mti_attr.ma_attr;
         struct req_capsule      *pill = &info->mti_pill;
index b74b6b9..6fa78ee 100644 (file)
@@ -87,7 +87,7 @@ static int mdt_create_data(struct mdt_thread_info *info,
         ma->ma_need = MA_INODE | MA_LOV;
         rc = mdo_create_data(info->mti_env,
                              p ? mdt_object_child(p) : NULL,
-                             mdt_object_child(o), spec, ma, &info->mti_uc);
+                             mdt_object_child(o), spec, ma);
         RETURN(rc);
 }
 
@@ -461,8 +461,7 @@ static int mdt_mfd_open(struct mdt_thread_info *info,
                 RETURN(rc);
 
         rc = mo_open(info->mti_env, mdt_object_child(o),
-                     created ? flags | MDS_OPEN_CREATED : flags,
-                     &info->mti_uc);
+                     created ? flags | MDS_OPEN_CREATED : flags);
         if (rc)
                 RETURN(rc);
 
@@ -553,7 +552,7 @@ void mdt_reconstruct_open(struct mdt_thread_info *info,
                 if (rc > 0) {
                         struct md_object *next;
                         next = mdt_object_child(child);
-                        rc = mo_attr_get(env, next, ma, NULL);
+                        rc = mo_attr_get(env, next, ma);
                         if (rc == 0)
                               rc = mdt_mfd_open(info, parent, child,
                                                 flags, 1, ldlm_rep);
@@ -607,7 +606,7 @@ static int mdt_open_by_fid(struct mdt_thread_info* info,
                                                 DISP_LOOKUP_EXECD |
                                                 DISP_LOOKUP_POS));
 
-                rc = mo_attr_get(env, mdt_object_child(o), ma, NULL);
+                rc = mo_attr_get(env, mdt_object_child(o), ma);
                 if (rc == 0)
                         rc = mdt_mfd_open(info, NULL, o, flags, 0, rep);
         } else if (rc == 0) {
@@ -646,7 +645,7 @@ static int mdt_cross_open(struct mdt_thread_info* info,
 
         rc = lu_object_exists(&o->mot_obj.mo_lu);
         if (rc > 0) {
-                rc = mo_attr_get(info->mti_env, mdt_object_child(o), ma, NULL);
+                rc = mo_attr_get(info->mti_env, mdt_object_child(o), ma);
                 if (rc == 0)
                         rc = mdt_mfd_open(info, NULL, o, flags, 0, rep);
         } else if (rc == 0) {
@@ -755,7 +754,7 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc)
                 GOTO(out, result = PTR_ERR(parent));
 
         result = mdo_lookup(info->mti_env, mdt_object_child(parent),
-                            rr->rr_name, child_fid, &info->mti_uc);
+                            rr->rr_name, child_fid);
         if (result != 0 && result != -ENOENT && result != -ESTALE)
                 GOTO(out_parent, result);
 
@@ -793,8 +792,7 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc)
                                     rr->rr_name,
                                     mdt_object_child(child),
                                     &info->mti_spec,
-                                    &info->mti_attr,
-                                    &info->mti_uc);
+                                    &info->mti_attr);
                 if (result == -ERESTART) {
                         mdt_clear_disposition(info, ldlm_rep, DISP_OPEN_CREATE);
                         GOTO(out_child, result);
@@ -807,7 +805,7 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc)
         } else {
                 /* We have to get attr & lov ea for this object */
                 result = mo_attr_get(info->mti_env, mdt_object_child(child),
-                                     ma, NULL);
+                                     ma);
                 /*
                  * The object is on remote node, return its FID for remote open.
                  */
@@ -866,8 +864,7 @@ finish_open:
                                  mdt_object_child(parent),
                                  mdt_object_child(child),
                                  rr->rr_name,
-                                 &info->mti_attr,
-                                 &info->mti_uc);
+                                 &info->mti_attr);
                 if (rc2 != 0)
                         CERROR("error in cleanup of open");
         }
@@ -914,9 +911,9 @@ int mdt_mfd_close(struct mdt_thread_info *info, struct mdt_file_data *mfd)
         ma->ma_need |= MA_INODE;
 
         if (!MFD_CLOSED(mode))
-                rc = mo_close(info->mti_env, next, ma, NULL);
+                rc = mo_close(info->mti_env, next, ma);
         else if (ret == -EAGAIN)
-                rc = mo_attr_get(info->mti_env, next, ma, NULL);
+                rc = mo_attr_get(info->mti_env, next, ma);
 
         /* If the object is unlinked, do not try to re-enable SIZEONMDS */
         if ((ret == -EAGAIN) && (ma->ma_valid & MA_INODE) &&
index e7d5f4b..bd91703 100644 (file)
@@ -1029,8 +1029,7 @@ static void mdt_reconstruct_create(struct mdt_thread_info *mti,
         LASSERT(!IS_ERR(child));
 
         body = req_capsule_server_get(&mti->mti_pill, &RMF_MDT_BODY);
-        rc = mo_attr_get(mti->mti_env, mdt_object_child(child),
-                         &mti->mti_attr, NULL);
+        rc = mo_attr_get(mti->mti_env, mdt_object_child(child), &mti->mti_attr);
         if (rc == -EREMOTE) {
                 /* object was created on remote server */
                 req->rq_status = rc;
@@ -1058,8 +1057,7 @@ static void mdt_reconstruct_setattr(struct mdt_thread_info *mti,
         obj = mdt_object_find(mti->mti_env, mdt, mti->mti_rr.rr_fid1,
                               mti->mti_rr.rr_capa1);
         LASSERT(!IS_ERR(obj));
-        mo_attr_get(mti->mti_env, mdt_object_child(obj),
-                    &mti->mti_attr, NULL);
+        mo_attr_get(mti->mti_env, mdt_object_child(obj), &mti->mti_attr);
         mdt_pack_attr2body(body, &mti->mti_attr.ma_attr, mdt_object_fid(obj));
         mdt_body_reverse_idmap(mti, body);
 
index 399c410..1c020e2 100644 (file)
@@ -69,7 +69,7 @@ static int mdt_md_create(struct mdt_thread_info *info)
 
                 rc = mdo_create(info->mti_env, next, rr->rr_name,
                                 mdt_object_child(child),
-                                &info->mti_spec, ma, &info->mti_uc);
+                                &info->mti_spec, ma);
                 if (rc == 0) {
                         /* return fid & attr to client. */
                         if (ma->ma_valid & MA_INODE)
@@ -103,7 +103,7 @@ static int mdt_md_mkobj(struct mdt_thread_info *info)
 
                 ma->ma_need = MA_INODE;
                 rc = mo_object_create(info->mti_env, next, &info->mti_spec,
-                                      ma, &info->mti_uc);
+                                      ma);
                 if (rc == 0) {
                         /* return fid & attr to client. */
                         if (ma->ma_valid & MA_INODE)
@@ -166,8 +166,7 @@ int mdt_attr_set(struct mdt_thread_info *info, struct mdt_object *mo, int flags)
                        OBD_FAIL_MDS_REINT_SETATTR_WRITE);
 
         /* all attrs are packed into mti_attr in unpack_setattr */
-        rc = mo_attr_set(info->mti_env, mdt_object_child(mo), ma,
-                         &info->mti_uc);
+        rc = mo_attr_set(info->mti_env, mdt_object_child(mo), ma);
         if (rc != 0)
                 GOTO(out, rc);
 
@@ -267,7 +266,7 @@ static int mdt_reint_setattr(struct mdt_thread_info *info,
 
         ma->ma_need = MA_INODE;
         next = mdt_object_child(mo);
-        rc = mo_attr_get(info->mti_env, next, ma, NULL);
+        rc = mo_attr_get(info->mti_env, next, ma);
         if (rc != 0)
                 GOTO(out, rc);
 
@@ -370,14 +369,13 @@ static int mdt_reint_unlink(struct mdt_thread_info *info,
 
         if (strlen(rr->rr_name) == 0) {
                 /* remote partial operation */
-                rc = mo_ref_del(info->mti_env, mdt_object_child(mp), ma,
-                                &info->mti_uc);
+                rc = mo_ref_del(info->mti_env, mdt_object_child(mp), ma);
                 GOTO(out_unlock_parent, rc);
         }
 
         /* step 2: find & lock the child */
         rc = mdo_lookup(info->mti_env, mdt_object_child(mp),
-                        rr->rr_name, child_fid, &info->mti_uc);
+                        rr->rr_name, child_fid);
         if (rc != 0)
                  GOTO(out_unlock_parent, rc);
 
@@ -401,7 +399,7 @@ static int mdt_reint_unlink(struct mdt_thread_info *info,
          */
         ma->ma_need = MA_INODE;
         rc = mdo_unlink(info->mti_env, mdt_object_child(mp),
-                        mdt_object_child(mc), rr->rr_name, ma, &info->mti_uc);
+                        mdt_object_child(mc), rr->rr_name, ma);
         if (rc)
                 GOTO(out_unlock_child, rc);
 
@@ -449,8 +447,7 @@ static int mdt_reint_link(struct mdt_thread_info *info,
 
         if (strlen(rr->rr_name) == 0) {
                 /* remote partial operation */
-                rc = mo_ref_add(info->mti_env, mdt_object_child(ms),
-                                &info->mti_uc);
+                rc = mo_ref_add(info->mti_env, mdt_object_child(ms));
                 GOTO(out_unlock_source, rc);
         }
         /*step 2: find & lock the target parent dir*/
@@ -467,7 +464,7 @@ static int mdt_reint_link(struct mdt_thread_info *info,
                        OBD_FAIL_MDS_REINT_LINK_WRITE);
 
         rc = mdo_link(info->mti_env, mdt_object_child(mp),
-                      mdt_object_child(ms), rr->rr_name, ma, &info->mti_uc);
+                      mdt_object_child(ms), rr->rr_name, ma);
         GOTO(out_unlock_target, rc);
 
 out_unlock_target:
@@ -507,7 +504,7 @@ static int mdt_reint_rename_tgt(struct mdt_thread_info *info)
 
         /*step 2: find & lock the target object if exists*/
         rc = mdo_lookup(info->mti_env, mdt_object_child(mtgtdir),
-                        rr->rr_tgt, tgt_fid, &info->mti_uc);
+                        rr->rr_tgt, tgt_fid);
         if (rc != 0 && rc != -ENOENT) {
                 GOTO(out_unlock_tgtdir, rc);
         } else if (rc == 0) {
@@ -520,12 +517,11 @@ static int mdt_reint_rename_tgt(struct mdt_thread_info *info)
 
                 rc = mdo_rename_tgt(info->mti_env, mdt_object_child(mtgtdir),
                                     mdt_object_child(mtgt), rr->rr_fid2,
-                                    rr->rr_tgt, ma, &info->mti_uc);
+                                    rr->rr_tgt, ma);
         } else /* -ENOENT */ {
                 rc = mdo_name_insert(info->mti_env, mdt_object_child(mtgtdir),
                                      rr->rr_tgt, rr->rr_fid2,
-                                     S_ISDIR(ma->ma_attr.la_mode),
-                                     &info->mti_uc);
+                                     S_ISDIR(ma->ma_attr.la_mode));
         }
 
         /* handle last link of tgt object */
@@ -604,9 +600,8 @@ static int mdt_rename_check(struct mdt_thread_info *info, struct lu_fid *fid)
                 dst = mdt_object_find(info->mti_env, info->mti_mdt, &dst_fid,
                                       BYPASS_CAPA);
                 if (!IS_ERR(dst)) {
-                        rc = mdo_is_subdir(info->mti_env,
-                                           mdt_object_child(dst),
-                                           fid, &dst_fid, NULL);
+                        rc = mdo_is_subdir(info->mti_env, mdt_object_child(dst),
+                                           fid, &dst_fid);
                         mdt_object_put(info->mti_env, dst);
                         if (rc < 0) {
                                 CERROR("Error while doing mdo_is_subdir(), rc %d\n",
@@ -627,7 +622,6 @@ static int mdt_reint_rename(struct mdt_thread_info *info,
 {
         struct mdt_reint_record *rr = &info->mti_rr;
         struct req_capsule      *pill = &info->mti_pill;
-        struct ptlrpc_request   *req = mdt_info_req(info);
         struct md_attr          *ma = &info->mti_attr;
         struct mdt_object       *msrcdir;
         struct mdt_object       *mtgtdir;
@@ -644,12 +638,6 @@ static int mdt_reint_rename(struct mdt_thread_info *info,
 
         ENTRY;
 
-#if 0
-        DEBUG_REQ(D_INODE, req, "rename "DFID"/%s to "DFID"/%s",
-                  PFID(rr->rr_fid1), rr->rr_name,
-                  PFID(rr->rr_fid2), rr->rr_tgt);
-#endif
-
         rc = req_capsule_get_size(pill, &RMF_NAME, RCL_CLIENT);
         if (rc == 1) {
         /* if (rr->rr_name[0] == 0) {*/
@@ -696,7 +684,7 @@ static int mdt_reint_rename(struct mdt_thread_info *info,
 
         /*step 3: find & lock the old object*/
         rc = mdo_lookup(info->mti_env, mdt_object_child(msrcdir),
-                        rr->rr_name, old_fid, &info->mti_uc);
+                        rr->rr_name, old_fid);
         if (rc != 0)
                 GOTO(out_unlock_target, rc);
 
@@ -713,7 +701,7 @@ static int mdt_reint_rename(struct mdt_thread_info *info,
         /*step 4: find & lock the new object*/
         /* new target object may not exist now */
         rc = mdo_lookup(info->mti_env, mdt_object_child(mtgtdir),
-                        rr->rr_tgt, new_fid, &info->mti_uc);
+                        rr->rr_tgt, new_fid);
         if (rc == 0) {
                 /* the new_fid should have been filled at this moment*/
                 if (lu_fid_eq(old_fid, new_fid))
@@ -765,7 +753,7 @@ static int mdt_reint_rename(struct mdt_thread_info *info,
         rc = mdo_rename(info->mti_env, mdt_object_child(msrcdir),
                         mdt_object_child(mtgtdir), old_fid, rr->rr_name,
                         (mnew ? mdt_object_child(mnew) : NULL),
-                        rr->rr_tgt, ma, &info->mti_uc);
+                        rr->rr_tgt, ma);
 
         /* handle last link of tgt object */
         if (rc == 0 && mnew)
index c0b136d..82325b6 100644 (file)
@@ -202,6 +202,7 @@ int mdt_rmtacl_upcall(struct mdt_thread_info *info, unsigned long key,
         struct obd_device               *obd = req->rq_export->exp_obd;
         struct mdt_device               *mdt = info->mti_mdt;
         struct lvfs_ucred               uc;
+        struct md_ucred                *uc0 = mdt_ucred(info);
         struct lvfs_run_ctxt            saved;
         struct rmtacl_upcall_data       data;
         struct upcall_cache_entry       *entry;
@@ -215,14 +216,14 @@ int mdt_rmtacl_upcall(struct mdt_thread_info *info, unsigned long key,
 
         data.aud_cmd = cmd;
 
-        uc.luc_uid      = info->mti_uc.mu_uid;
-        uc.luc_gid      = info->mti_uc.mu_gid;
-        uc.luc_fsuid    = info->mti_uc.mu_fsuid;
-        uc.luc_fsgid    = info->mti_uc.mu_fsgid;
-        uc.luc_cap      = info->mti_uc.mu_cap;
-        uc.luc_umask    = info->mti_uc.mu_umask;
-        uc.luc_ginfo    = info->mti_uc.mu_ginfo;
-        uc.luc_identity = info->mti_uc.mu_identity;
+        uc.luc_uid      = uc0->mu_uid;
+        uc.luc_gid      = uc0->mu_gid;
+        uc.luc_fsuid    = uc0->mu_fsuid;
+        uc.luc_fsgid    = uc0->mu_fsgid;
+        uc.luc_cap      = uc0->mu_cap;
+        uc.luc_umask    = uc0->mu_umask;
+        uc.luc_ginfo    = uc0->mu_ginfo;
+        uc.luc_identity = uc0->mu_identity;
 
         push_ctxt(&saved, &obd->obd_lvfs_ctxt, &uc);
         entry = upcall_cache_get_entry(mdt->mdt_rmtacl_cache, (__u64)key,
index 9001e14..4c5107a 100644 (file)
@@ -73,11 +73,11 @@ static int mdt_getxattr_pack_reply(struct mdt_thread_info * info)
                 else
                         rc = mo_xattr_get(info->mti_env,
                                           mdt_object_child(info->mti_object),
-                                          &LU_BUF_NULL, xattr_name, NULL);
+                                          &LU_BUF_NULL, xattr_name);
         } else if ((valid & OBD_MD_FLXATTRLS) == OBD_MD_FLXATTRLS) {
                 rc = mo_xattr_list(info->mti_env,
                                    mdt_object_child(info->mti_object),
-                                   &LU_BUF_NULL, NULL);
+                                   &LU_BUF_NULL);
         } else {
                 CERROR("valid bits: "LPX64"\n", info->mti_body->valid);
                 return -EINVAL;
@@ -174,8 +174,7 @@ int mdt_getxattr(struct mdt_thread_info *info)
 
                         rc = do_remote_getfacl(info, &body->fid1, buf);
                 } else {
-                        rc = mo_xattr_get(info->mti_env, next, buf,
-                                          xattr_name, NULL);
+                        rc = mo_xattr_get(info->mti_env, next, buf, xattr_name);
                 }
 
                 if (rc < 0 && rc != -ENODATA && rc != -EOPNOTSUPP &&
@@ -184,7 +183,7 @@ int mdt_getxattr(struct mdt_thread_info *info)
         } else if (info->mti_body->valid & OBD_MD_FLXATTRLS) {
                 CDEBUG(D_INODE, "listxattr\n");
 
-                rc = mo_xattr_list(info->mti_env, next, buf, NULL);
+                rc = mo_xattr_list(info->mti_env, next, buf);
                 if (rc < 0)
                         CDEBUG(D_OTHER, "listxattr failed: %d\n", rc);
         } else
@@ -344,11 +343,10 @@ int mdt_setxattr(struct mdt_thread_info *info)
 
                         buf->lb_buf = xattr;
                         buf->lb_len = xattr_len;
-                        rc = mo_xattr_set(env, child, buf,
-                                          xattr_name, flags, &info->mti_uc);
+                        rc = mo_xattr_set(env, child, buf, xattr_name, flags);
                 }
         } else if ((valid & OBD_MD_FLXATTRRM) == OBD_MD_FLXATTRRM) {
-                rc = mo_xattr_del(env, child, xattr_name, &info->mti_uc);
+                rc = mo_xattr_del(env, child, xattr_name);
         } else {
                 CERROR("valid bits: "LPX64"\n", body->valid);
                 rc = -EINVAL;