From 5c2180bff494e907990e54ce8ef6a4af38778b44 Mon Sep 17 00:00:00 2001 From: Landen Date: Tue, 30 Mar 2010 11:59:00 -0700 Subject: [PATCH] b=22272 size should be valid when no objects are allocated in osts 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 1faf7e5..bba5347 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -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; -- 1.8.3.1