Whamcloud - gitweb
b=22272 size should be valid when no objects are allocated in osts
authorLanden <landen@sun.com>
Tue, 30 Mar 2010 18:59:00 +0000 (11:59 -0700)
committerRobert Read <rread@sun.com>
Tue, 30 Mar 2010 18:59:00 +0000 (11:59 -0700)
If no objects on osts for a file && truncating is done on an empty file,
the size on mds is valid. It should be transferred to clients.

i=tappro
i=robert.read
i=andreas.dilger

lustre/mdt/mdt_handler.c

index 1faf7e5..bba5347 100644 (file)
@@ -400,6 +400,8 @@ static void mdt_pack_size2body(struct mdt_thread_info *info,
 void mdt_pack_attr2body(struct mdt_thread_info *info, struct mdt_body *b,
                         const struct lu_attr *attr, const struct lu_fid *fid)
 {
+        struct md_attr          *ma  = &info->mti_attr;
+
         /*XXX should pack the reply body according to lu_valid*/
         b->valid |= OBD_MD_FLCTIME | OBD_MD_FLUID   |
                     OBD_MD_FLGID   | OBD_MD_FLTYPE  |
@@ -409,6 +411,10 @@ void mdt_pack_attr2body(struct mdt_thread_info *info, struct mdt_body *b,
         if (!S_ISREG(attr->la_mode))
                 b->valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS | OBD_MD_FLRDEV;
 
+        /* if no object is allocated on osts, the size on mds is valid. b=22272 */
+        if (ma->ma_lmm_size == 0)
+                b->valid |= OBD_MD_FLSIZE;
+
         b->atime      = attr->la_atime;
         b->mtime      = attr->la_mtime;
         b->ctime      = attr->la_ctime;