Whamcloud - gitweb
LU-2561 mdd: create decares attr set with parent attr
authorLai Siyao <laisiyao@whamcloud.com>
Wed, 12 Dec 2012 05:20:33 +0000 (13:20 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 26 Jan 2013 04:07:48 +0000 (23:07 -0500)
mdd_declare_create() mistakenly declares attr set for child with
parent attr, as will cause truncate operation.

Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Change-Id: I79dbbb2b52e1d41aaa70c36ce6c197ab2cd684d8
Reviewed-on: http://review.whamcloud.com/4956
Reviewed-by: Prakash Surya <surya1@llnl.gov>
Tested-by: Hudson
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mdd/mdd_dir.c
lustre/tests/acl/2561.test [new file with mode: 0644]
lustre/tests/acl/974.test
lustre/tests/sanity.sh

index 6ba30e3..dcb754d 100644 (file)
@@ -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 (file)
index 0000000..b112dba
--- /dev/null
@@ -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
+
index 2026681..070bd20 100644 (file)
@@ -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
index f9d6c3d..0d03287 100644 (file)
@@ -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