Whamcloud - gitweb
mdt: translate ATTR_FROM_OPEN
authornikita <nikita>
Sat, 12 Aug 2006 08:56:36 +0000 (08:56 +0000)
committernikita <nikita>
Sat, 12 Aug 2006 08:56:36 +0000 (08:56 +0000)
lustre/mdt/mdt_internal.h
lustre/mdt/mdt_lib.c
lustre/mdt/mdt_reint.c

index ca6ef8b..1717ab6 100644 (file)
@@ -118,7 +118,7 @@ struct mdt_device {
                 signed int         mo_acl        :1;
                 signed int         mo_compat_resname:1;
         } mdt_opts;
-        
+
         /* lock to pretect epoch and write count
          * because we need not allocate memory, spinlock is fast.
          */
@@ -184,7 +184,11 @@ struct mdt_reint_record {
         const void          *rr_eadata;
         int                  rr_logcookielen;
         const struct llog_cookie  *rr_logcookies;
+        __u32                rr_flags;
+};
 
+enum mdt_reint_flag {
+        MRF_SETATTR_LOCKED = 1 << 0
 };
 
 enum {
@@ -263,7 +267,7 @@ struct mdt_thread_info {
         /* transaction number of current request */
         __u64                      mti_transno;
         __u32                      mti_trans_flags;
-        
+
         /* readdir hint structure */
         struct lu_rdpg             mti_rdpg;
 };
index 1b33ff5..355e670 100644 (file)
@@ -133,7 +133,7 @@ int mdt_handle_last_unlink(struct mdt_thread_info *info, struct mdt_object *mo,
         RETURN(0);
 }
 
-static __u64 mdt_attr_valid_xlate(__u64 in)
+static __u64 mdt_attr_valid_xlate(__u64 in, struct mdt_reint_record *rr)
 {
         __u64 out;
 
@@ -152,8 +152,12 @@ static __u64 mdt_attr_valid_xlate(__u64 in)
                 out |= LA_MTIME;
         if (in & ATTR_CTIME)
                 out |= LA_CTIME;
+
+        if (in & ATTR_FROM_OPEN)
+                rr->rr_flags |= MRF_SETATTR_LOCKED;
+
         in &= ~(ATTR_MODE|ATTR_UID|ATTR_GID|ATTR_SIZE|
-                ATTR_ATIME|ATTR_MTIME|ATTR_CTIME);
+                ATTR_ATIME|ATTR_MTIME|ATTR_CTIME|ATTR_FROM_OPEN);
         if (in != 0)
                 CERROR("Unknown attr bits: %#llx\n", in);
         return out;
@@ -175,7 +179,7 @@ static int mdt_setattr_unpack(struct mdt_thread_info *info)
                 RETURN(-EFAULT);
 
         rr->rr_fid1 = &rec->sa_fid;
-        la->la_valid = mdt_attr_valid_xlate(rec->sa_valid);
+        la->la_valid = mdt_attr_valid_xlate(rec->sa_valid, rr);
         la->la_mode  = rec->sa_mode;
         la->la_uid   = rec->sa_uid;
         la->la_gid   = rec->sa_gid;
index bf8b441..291b49c 100644 (file)
@@ -115,7 +115,8 @@ static int mdt_md_mkobj(struct mdt_thread_info *info)
 /* In the raw-setattr case, we lock the child inode.
  * In the write-back case or if being called from open,
  *               the client holds a lock already.
- * We use the ATTR_FROM_OPEN flag to tell these cases apart. */
+ * We use the ATTR_FROM_OPEN (translated into MRF_SETATTR_LOCKED by
+ * mdt_setattr_unpack()) flag to tell these cases apart. */
 static int mdt_reint_setattr(struct mdt_thread_info *info)
 {
         struct lu_attr          *attr = &info->mti_attr.ma_attr;
@@ -125,7 +126,6 @@ static int mdt_reint_setattr(struct mdt_thread_info *info)
         struct md_object        *next;
         struct mdt_lock_handle  *lh;
         struct mdt_body         *repbody;
-        /*__u64                   valid = attr->la_valid;*/
         int                      rc;
 
         ENTRY;
@@ -141,7 +141,7 @@ static int mdt_reint_setattr(struct mdt_thread_info *info)
         lh = &info->mti_lh[MDT_LH_PARENT];
         lh->mlh_mode = LCK_EX;
 
-        if (attr->la_valid & ATTR_FROM_OPEN) {
+        if (rr->rr_flags & MRF_SETATTR_LOCKED) {
                 mo = mdt_object_find(info->mti_ctxt, info->mti_mdt,
                                      rr->rr_fid1);
         } else {