From: John L. Hammond Date: Fri, 14 Jun 2013 01:07:50 +0000 (-0500) Subject: LU-3448 llite: call simple_setattr() from ll_md_setattr() X-Git-Tag: 2.4.51~4 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=101f527e687941024311ab42f4c5843421448234 LU-3448 llite: call simple_setattr() from ll_md_setattr() 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 Change-Id: I201882a4ee42d8c63121477b6d7495cbb9701465 Reviewed-on: http://review.whamcloud.com/6643 Reviewed-by: jacques-Charles Lafoucriere Tested-by: Hudson Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index e6adb42..f84271f 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1305,6 +1305,13 @@ int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data, 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; @@ -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; - unsigned int valid = attr->ia_valid; 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: - 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); @@ -1567,8 +1566,7 @@ out: 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) diff --git a/lustre/lov/lov_io.c b/lustre/lov/lov_io.c index 6f6ea84..8322798 100644 --- a/lustre/lov/lov_io.c +++ b/lustre/lov/lov_io.c @@ -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: - case CIT_SETATTR: result = +1; break; + case CIT_SETATTR: case CIT_READ: case CIT_WRITE: case CIT_FAULT: diff --git a/lustre/tests/multiop.c b/lustre/tests/multiop.c index 541e1b0..8b83c17 100644 --- a/lustre/tests/multiop.c +++ b/lustre/tests/multiop.c @@ -73,6 +73,7 @@ char usage[] = " 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" diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 20599f5..d64d161 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -11130,12 +11130,15 @@ test_228c() { } 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 + [ $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 || - error "failed to create file w. released layout" + error "failed to create file with released layout" $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" - $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" @@ -11156,7 +11164,7 @@ test_229() { # LU-2482 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