Whamcloud - gitweb
Instead of setting all of the valid flags, and then clearing them for
authoradilger <adilger>
Mon, 14 Jul 2003 22:37:20 +0000 (22:37 +0000)
committeradilger <adilger>
Mon, 14 Jul 2003 22:37:20 +0000 (22:37 +0000)
regular files if an EA is found, we instead leave them unset for regular
files and only set them if we find we do not find an EA.  This avoids
sending back bad data to the client if we abort early because of error
and do not clear the valid flags (POSIX.os/files/open/T.open 31).

lustre/mds/mds_lib.c

index 5ae1e4f..93ac300 100644 (file)
@@ -60,10 +60,12 @@ void mds_pack_inode2fid(struct ll_fid *fid, struct inode *inode)
 /* Note that we can copy all of the fields, just some will not be "valid" */
 void mds_pack_inode2body(struct mds_body *b, struct inode *inode)
 {
-        b->valid = OBD_MD_FLID | OBD_MD_FLATIME | OBD_MD_FLMTIME |
-                OBD_MD_FLCTIME | OBD_MD_FLSIZE | OBD_MD_FLBLOCKS |
-                OBD_MD_FLUID | OBD_MD_FLGID | OBD_MD_FLTYPE | OBD_MD_FLMODE |
-                OBD_MD_FLNLINK | OBD_MD_FLGENER;
+        b->valid = OBD_MD_FLID | OBD_MD_FLCTIME | OBD_MD_FLUID | OBD_MD_FLGID |
+                OBD_MD_FLTYPE | OBD_MD_FLMODE | OBD_MD_FLNLINK | OBD_MD_FLGENER;
+
+        if (!S_ISREG(inode->i_mode))
+                b->valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS | OBD_MD_FLATIME |
+                            OBD_MD_FLMTIME;
 
         b->ino = inode->i_ino;
         b->atime = LTIME_S(inode->i_atime);