From: Lai Siyao Date: Wed, 12 Dec 2012 05:20:33 +0000 (+0800) Subject: LU-2561 mdd: create decares attr set with parent attr X-Git-Tag: 2.3.60~17 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=20040d7f9529b933fd9778da0d3f3be0df4d876b LU-2561 mdd: create decares attr set with parent attr mdd_declare_create() mistakenly declares attr set for child with parent attr, as will cause truncate operation. Signed-off-by: Lai Siyao Change-Id: I79dbbb2b52e1d41aaa70c36ce6c197ab2cd684d8 Reviewed-on: http://review.whamcloud.com/4956 Reviewed-by: Prakash Surya Tested-by: Hudson Reviewed-by: Bobi Jam Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 6ba30e3..dcb754d 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -1556,8 +1556,7 @@ static int mdd_declare_create(const struct lu_env *env, struct mdd_device *mdd, struct thandle *handle, const struct md_op_spec *spec) { - struct mdd_thread_info *info = mdd_env_info(env); - int rc = 0; + int rc; rc = mdd_declare_object_create_internal(env, p, c, attr, handle, spec); if (rc) @@ -1577,7 +1576,7 @@ static int mdd_declare_create(const struct lu_env *env, struct mdd_device *mdd, GOTO(out, rc); } - rc = mdo_declare_attr_set(env, c, &info->mti_pattr, handle); + rc = mdo_declare_attr_set(env, c, attr, handle); if (rc) GOTO(out, rc); diff --git a/lustre/tests/acl/2561.test b/lustre/tests/acl/2561.test new file mode 100644 index 0000000..b112dba --- /dev/null +++ b/lustre/tests/acl/2561.test @@ -0,0 +1,10 @@ +LU-2561 newly created file is same size as directory + + $ mkdir 2561 + $ cd 2561 + $ getfacl --access . | setfacl -d -M- . + $ touch f1 + $ ls -s f1 + > 0 f1 + $ rm -rf 2561 + diff --git a/lustre/tests/acl/974.test b/lustre/tests/acl/974.test index 2026681..070bd20 100644 --- a/lustre/tests/acl/974.test +++ b/lustre/tests/acl/974.test @@ -1,18 +1,20 @@ LU-974 ignore umask when default acl with mask is set $ umask 022 - $ mkdir d + $ mkdir 974 - $ touch d/f1 - $ ls -dl d/f1 | awk '{ print $1 }' + $ touch 974/f1 + $ ls -dl 974/f1 | awk '{ print $1 }' > -rw-r--r-- - $ setfacl -R -d -m mask:007 d - $ touch d/f2 - $ ls -dl d/f2 | awk '{ print $1 }' + $ setfacl -R -d -m mask:007 974 + $ touch 974/f2 + $ ls -dl 974/f2 | awk '{ print $1 }' > -rw-rw-r--+ $ umask 077 $ touch f3 $ ls -dl f3 | awk '{ print $1 }' > -rw------- + + $ rm -rf 974 diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index f9d6c3d..0d03287 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -6133,10 +6133,10 @@ test_103 () { rm -f make-tree echo "LU-974 ignore umask when acl is enabled..." - mkdir $DIR/974 - cd $DIR/974 run_acl_subtest 974 || error "LU-974 test failed" - rm -rf $DIR/974 + + echo "LU-2561 newly created file is same size as directory..." + run_acl_subtest 2561 || error "LU-2561 test failed" cd $SAVE_PWD umask $SAVE_UMASK