Whamcloud - gitweb
LU-3448 llite: call simple_setattr() from ll_md_setattr() 43/6643/4
authorJohn L. Hammond <john.hammond@intel.com>
Fri, 14 Jun 2013 01:07:50 +0000 (20:07 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 21 Jun 2013 20:44:54 +0000 (20:44 +0000)
This partially reverts the change from "LU-2482 layout: introduce new
layout for released files" by calling simple_setattr() from
ll_md_setattr() without ATTR_SIZE set. Doing so avoids failed
assertions in osc_page_delete(). Disable truncates on released files
and modify sanity 229 accordingly.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I201882a4ee42d8c63121477b6d7495cbb9701465
Reviewed-on: http://review.whamcloud.com/6643
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/llite_lib.c
lustre/lov/lov_io.c
lustre/tests/multiop.c
lustre/tests/sanity.sh

index e6adb42..f84271f 100644 (file)
@@ -1305,6 +1305,13 @@ int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data,
                 RETURN(rc);
         }
 
                 RETURN(rc);
         }
 
+       ia_valid = op_data->op_attr.ia_valid;
+       /* inode size will be in ll_setattr_ost, can't do it now since dirty
+        * cache is not cleared yet. */
+       op_data->op_attr.ia_valid &= ~(TIMES_SET_FLAGS | ATTR_SIZE);
+       rc = simple_setattr(dentry, &op_data->op_attr);
+       op_data->op_attr.ia_valid = ia_valid;
+
         /* Extract epoch data if obtained. */
         op_data->op_handle = md.body->handle;
         op_data->op_ioepoch = md.body->ioepoch;
         /* Extract epoch data if obtained. */
         op_data->op_handle = md.body->handle;
         op_data->op_ioepoch = md.body->ioepoch;
@@ -1430,7 +1437,6 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr)
         struct ll_inode_info *lli = ll_i2info(inode);
         struct md_op_data *op_data = NULL;
         struct md_open_data *mod = NULL;
         struct ll_inode_info *lli = ll_i2info(inode);
         struct md_op_data *op_data = NULL;
         struct md_open_data *mod = NULL;
-       unsigned int valid = attr->ia_valid;
         int rc = 0, rc1 = 0;
         ENTRY;
 
         int rc = 0, rc1 = 0;
         ENTRY;
 
@@ -1542,13 +1548,6 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr)
                 rc = ll_setattr_ost(inode, attr);
         EXIT;
 out:
                 rc = ll_setattr_ost(inode, attr);
         EXIT;
 out:
-       if (rc == 0) {
-               /* Update inode attribute after dirty cache is cleaned
-                * by truncating OST objects. */
-               attr->ia_valid |= ATTR_FORCE;
-               rc = simple_setattr(dentry, attr);
-               LASSERT(rc == 0);
-       }
         if (op_data) {
                 if (op_data->op_ioepoch) {
                         rc1 = ll_setattr_done_writing(inode, op_data, mod);
         if (op_data) {
                 if (op_data->op_ioepoch) {
                         rc1 = ll_setattr_done_writing(inode, op_data, mod);
@@ -1567,8 +1566,7 @@ out:
        ll_stats_ops_tally(ll_i2sbi(inode), (attr->ia_valid & ATTR_SIZE) ?
                        LPROC_LL_TRUNC : LPROC_LL_SETATTR, 1);
 
        ll_stats_ops_tally(ll_i2sbi(inode), (attr->ia_valid & ATTR_SIZE) ?
                        LPROC_LL_TRUNC : LPROC_LL_SETATTR, 1);
 
-       attr->ia_valid = valid;
-       RETURN(rc);
+       return rc;
 }
 
 int ll_setattr(struct dentry *de, struct iattr *attr)
 }
 
 int ll_setattr(struct dentry *de, struct iattr *attr)
index 6f6ea84..8322798 100644 (file)
@@ -984,9 +984,9 @@ int lov_io_init_released(const struct lu_env *env, struct cl_object *obj,
                LASSERTF(0, "invalid type %d\n", io->ci_type);
        case CIT_MISC:
        case CIT_FSYNC:
                LASSERTF(0, "invalid type %d\n", io->ci_type);
        case CIT_MISC:
        case CIT_FSYNC:
-       case CIT_SETATTR:
                result = +1;
                break;
                result = +1;
                break;
+       case CIT_SETATTR:
        case CIT_READ:
        case CIT_WRITE:
        case CIT_FAULT:
        case CIT_READ:
        case CIT_WRITE:
        case CIT_FAULT:
index 541e1b0..8b83c17 100644 (file)
@@ -73,6 +73,7 @@ char usage[] =
 "       D  open(O_DIRECTORY)\n"
 "       f  statfs\n"
 "       F  print FID\n"
 "       D  open(O_DIRECTORY)\n"
 "       f  statfs\n"
 "       F  print FID\n"
+"       H[num] create HSM released file with num stripes\n"
 "       G gid get grouplock\n"
 "       g gid put grouplock\n"
 "       K  link path to filename\n"
 "       G gid get grouplock\n"
 "       g gid put grouplock\n"
 "       K  link path to filename\n"
index 20599f5..d64d161 100644 (file)
@@ -11130,12 +11130,15 @@ test_228c() {
 }
 run_test 228c "NOT shrink the last entry in OI index node to recycle idle leaf"
 
 }
 run_test 228c "NOT shrink the last entry in OI index node to recycle idle leaf"
 
-test_229() { # LU-2482
+test_229() { # LU-2482, LU-3448
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
+
+       rm -f $DIR/$tfile
 
 
-       # Create a file with a release layout (stripe count = 0)
+       # Create a file with a released layout and stripe count 2.
        $MULTIOP $DIR/$tfile H2c ||
        $MULTIOP $DIR/$tfile H2c ||
-               error "failed to create file w. released layout"
+               error "failed to create file with released layout"
 
        $GETSTRIPE -v $DIR/$tfile
 
 
        $GETSTRIPE -v $DIR/$tfile
 
@@ -11147,8 +11150,13 @@ test_229() { # LU-2482
        [ $stripe_count -eq 2 ] || error "stripe count not 2 ($stripe_count)"
        stat $DIR/$tfile || error "failed to stat released file"
 
        [ $stripe_count -eq 2 ] || error "stripe count not 2 ($stripe_count)"
        stat $DIR/$tfile || error "failed to stat released file"
 
-       $TRUNCATE $DIR/$tfile 200000
-       $CHECKSTAT -s 200000 $DIR/$tfile || error
+       # Truncate should fail.
+       $TRUNCATE $DIR/$tfile 200000 &&
+               error "truncate of released file should fail"
+
+       # Ensure that nothing happened anyway.
+       $CHECKSTAT -s 0 $DIR/$tfile ||
+               error "released file size should not change"
 
        # Stripe count should be no change after truncate
        stripe_count=$($GETSTRIPE -c $DIR/$tfile) || error "getstripe failed"
 
        # Stripe count should be no change after truncate
        stripe_count=$($GETSTRIPE -c $DIR/$tfile) || error "getstripe failed"
@@ -11156,7 +11164,7 @@ test_229() { # LU-2482
 
        rm $DIR/$tfile || error "failed to remove released file"
 }
 
        rm $DIR/$tfile || error "failed to remove released file"
 }
-run_test 229 "getstripe/stat/rm work on released files (stripe count = 0)"
+run_test 229 "getstripe/stat/rm work on released files (stripe count = 2)"
 
 test_230a() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
 
 test_230a() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return