Whamcloud - gitweb
LU-6087 lod: use correct attrs in striped directory create 73/13473/2
authorJohn L. Hammond <john.hammond@intel.com>
Tue, 20 Jan 2015 22:02:45 +0000 (16:02 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 26 Jan 2015 22:00:49 +0000 (22:00 +0000)
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 <john.hammond@intel.com>
Change-Id: Icc511d0f56888bcc8c095f0da4a6bdf99ccdeab5
Reviewed-on: http://review.whamcloud.com/13473
Tested-by: Jenkins
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lod/lod_object.c
lustre/tests/sanity.sh

index bb9aac4..5dbd0b9 100644 (file)
@@ -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);
index eac1fff..e06ab8e 100644 (file)
@@ -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