#define OBD_FAIL_OST_BRW_PAUSE_PACK 0x224
#define OBD_FAIL_OST_CONNECT_NET2 0x225
#define OBD_FAIL_OST_NOMEM 0x226
+#define OBD_FAIL_OST_BRW_PAUSE_BULK2 0x227
#define OBD_FAIL_LDLM 0x300
#define OBD_FAIL_LDLM_NAMESPACE_NEW 0x301
filter = &exp->exp_obd->u.filter;
push_ctxt(&saved, &exp->exp_obd->obd_lvfs_ctxt, NULL);
+ /*
+ * We need to be atomic against a concurrent write
+ * (which takes the semaphore for reading). fmd_mactime_xid
+ * checks will have no effect if a write request with lower
+ * xid starts just before a setattr and finishes later than
+ * the setattr (see bug 21489, comment 27).
+ */
if (oa->o_valid &
(OBD_MD_FLMTIME | OBD_MD_FLATIME | OBD_MD_FLCTIME)) {
+ down_write(&dentry->d_inode->i_alloc_sem);
fmd = filter_fmd_get(exp, oa->o_id, oa->o_gr);
if (fmd && fmd->fmd_mactime_xid < oti->oti_xid)
fmd->fmd_mactime_xid = oti->oti_xid;
filter_fmd_put(exp, fmd);
+ up_write(&dentry->d_inode->i_alloc_sem);
}
/* setting objects attributes (including owner/group) */
fsfilt_check_slow(obd, now, "preprw_write setup");
+ /* Filter truncate first locks i_mutex then partially truncated
+ * page, filter write code first locks pages then take
+ * i_mutex. To avoid a deadlock in case of concurrent
+ * punch/write requests from one client, filter writes and
+ * filter truncates are serialized by i_alloc_sem, allowing
+ * multiple writes or single truncate. */
+ down_read(&dentry->d_inode->i_alloc_sem);
+
/* Don't update inode timestamps if this write is older than a
* setattr which modifies the timestamps. b=10150 */
/* XXX when we start having persistent reservations this needs to
cfs_spin_unlock(&obd->obd_osfs_lock);
filter_fmd_put(exp, fmd);
+ OBD_FAIL_TIMEOUT(OBD_FAIL_OST_BRW_PAUSE_BULK2, (obd_timeout + 1) / 4);
+
if (rc)
GOTO(cleanup, rc);
cleanup_phase = 4;
- /* Filter truncate first locks i_mutex then partally truncated
- * page, filter write code first locks pages then take
- * i_mutex. To avoid a deadlock in case of concurrent
- * punch/write requests from one client, filter writes and
- * filter truncates are serialized by i_alloc_sem, allowing
- * multiple writes or single truncate. */
- down_read(&dentry->d_inode->i_alloc_sem);
-
cfs_gettimeofday(&start);
for (i = 0, lnb = res; i < *npages; i++, lnb++) {
lnb->page = NULL;
}
}
- up_read(&dentry->d_inode->i_alloc_sem);
}
case 3:
+ if (rc)
+ up_read(&dentry->d_inode->i_alloc_sem);
+
filter_iobuf_put(&obd->u.filter, iobuf, oti);
case 2:
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
repbody->oa.o_gid = o_gid;
}
+ /*
+ * Disable sending mtime back to the client. If the client locked the
+ * whole object, then it has already updated the mtime on its side,
+ * otherwise it will have to glimpse anyway (see bug 21489, comment 32)
+ */
+ repbody->oa.o_valid &= ~(OBD_MD_FLMTIME | OBD_MD_FLATIME);
+
if (unlikely(client_cksum != server_cksum && rc == 0)) {
int new_cksum = ost_checksum_bulk(desc, OST_WRITE, cksum_type);
char *msg;
. ${CONFIG:=$LUSTRE/tests/cfg/${NAME}.sh}
init_logging
-[ "$SLOW" = "no" ] && EXCEPT_SLOW="24o 24v 27m 36f 36g 51b 51c 60c 63 64b 68 71 73 77f 78 101 103 115 120g 124b"
+[ "$SLOW" = "no" ] && EXCEPT_SLOW="24o 24v 27m 36f 36g 36h 51b 51c 60c 63 64b 68 71 73 77f 78 101 103 115 120g 124b"
SANITYLOG=${TESTSUITELOG:-$TMP/$(basename $0 .sh).log}
FAIL_ON_ERROR=false
}
run_test 36e "utime on non-owned file (should return error) ===="
-test_36f() {
+subr_36fh() {
+ local fl="$1"
local LANG_SAVE=$LANG
local LC_LANG_SAVE=$LC_LANG
export LANG=C LC_LANG=C # for date language
DATESTR="Dec 20 2000"
mkdir -p $DIR/$tdir
- #define OBD_FAIL_OST_BRW_PAUSE_BULK 0x214
- lctl set_param fail_loc=0x80000214
+ lctl set_param fail_loc=$fl
date; date +%s
cp /etc/hosts $DIR/$tdir/$tfile
sync & # write RPC generated with "current" inode timestamp, but delayed
export LANG=$LANG_SAVE LC_LANG=$LC_LANG_SAVE
}
+
+test_36f() {
+ #define OBD_FAIL_OST_BRW_PAUSE_BULK 0x214
+ subr_36fh "0x80000214"
+}
run_test 36f "utime on file racing with OST BRW write =========="
test_36g() {
}
run_test 36g "filter mod data cache expiry ====================="
+test_36h() {
+ #define OBD_FAIL_OST_BRW_PAUSE_BULK2 0x227
+ subr_36fh "0x80000227"
+}
+run_test 36h "utime on file racing with OST BRW write =========="
+
test_37() {
mkdir -p $DIR/$tdir
echo f > $DIR/$tdir/fbugfile