From: John L. Hammond Date: Tue, 20 Jan 2015 22:02:45 +0000 (-0600) Subject: LU-6087 lod: use correct attrs in striped directory create X-Git-Tag: 2.6.93~8 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F73%2F13473%2F2;p=fs%2Flustre-release.git LU-6087 lod: use correct attrs in striped directory create In lod_xattr_set_lmv() use the times, ownership, and mode of the local object when creating the shards. Add test_33f to sanity.sh to check that the ownership is handled properly. Signed-off-by: John L. Hammond Change-Id: Icc511d0f56888bcc8c095f0da4a6bdf99ccdeab5 Reviewed-on: http://review.whamcloud.com/13473 Tested-by: Jenkins Reviewed-by: wangdi Reviewed-by: Niu Yawei Reviewed-by: Alex Zhuravlev Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index bb9aac4..5dbd0b9 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -2417,7 +2417,8 @@ static int lod_xattr_set_lmv(const struct lu_env *env, struct dt_object *dt, if (rc != 0) RETURN(rc); - attr->la_valid = LA_TYPE | LA_MODE; + attr->la_valid = LA_ATIME | LA_MTIME | LA_CTIME | + LA_MODE | LA_UID | LA_GID | LA_TYPE; dof->dof_type = DFT_DIR; rc = lod_prep_lmv_md(env, dt, &lmv_buf); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index eac1fff..e06ab8e 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -2729,6 +2729,35 @@ test_33e() { } run_test 33e "mkdir and striped directory should have same mode" +cleanup_33f() { + trap 0 + do_facet $SINGLEMDS $LCTL set_param mdt.*.enable_remote_dir_gid=0 +} + +test_33f() { + [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return + + mkdir $DIR/$tdir + chmod go+rwx $DIR/$tdir + do_facet $SINGLEMDS $LCTL set_param mdt.*.enable_remote_dir_gid=-1 + trap cleanup_33f EXIT + + $RUNAS lfs mkdir -c$MDSCOUNT $DIR/$tdir/striped_dir || + error "cannot create striped directory" + + $RUNAS touch $DIR/$tdir/striped_dir/{0..16} || + error "cannot create files in striped directory" + + $RUNAS rm $DIR/$tdir/striped_dir/{0..16} || + error "cannot remove files in striped directory" + + $RUNAS rmdir $DIR/$tdir/striped_dir || + error "cannot remove striped directory" + + cleanup_33f +} +run_test 33f "nonroot user can create, access, and remove a striped directory" + TEST_34_SIZE=${TEST_34_SIZE:-2000000000000} test_34a() { rm -f $DIR/f34