From 1eed16faa4de4345221306b75bb36d737b8d8f3e Mon Sep 17 00:00:00 2001 From: pravin Date: Mon, 5 Apr 2010 11:49:56 -0700 Subject: [PATCH] b=21476 fix race between mdt_finish and __mds_lov_synchronize i=FanYong i=Rahul --- lustre/include/obd_support.h | 2 +- lustre/mdd/mdd_device.c | 4 ++++ lustre/mds/mds_lov.c | 1 + lustre/tests/recovery-small.sh | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index ae14668..87798f8 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -403,7 +403,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type, #define OBD_FAIL_LLOG_ORIGIN_HANDLE_WRITE_REC_NET 0x1307 #define OBD_FAIL_LLOG_ORIGIN_HANDLE_CLOSE_NET 0x1308 #define OBD_FAIL_LLOG_CATINFO_NET 0x1309 - +#define OBD_FAIL_MDS_SYNC_CAPA_SL 0x1310 /* Failure injection control */ #define OBD_FAIL_MASK_SYS 0x0000FF00 diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index 95408d8..9262fa9 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -1165,7 +1165,11 @@ static int mdd_init_capa_ctxt(const struct lu_env *env, struct md_device *m, int rc; ENTRY; + /* need barrier for mds_capa_keys access. */ + cfs_down_write(&mds->mds_notify_lock); mds->mds_capa_keys = keys; + cfs_up_write(&mds->mds_notify_lock); + rc = mdd_child_ops(mdd)->dt_init_capa_ctxt(env, mdd->mdd_child, mode, timeout, alg, keys); RETURN(rc); diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index ac9fa01..0572938 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -791,6 +791,7 @@ static int mds_propagate_capa_keys(struct mds_obd *mds, struct obd_uuid *uuid) if (!mds->mds_capa_keys) RETURN(0); + OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_SYNC_CAPA_SL, 5); for (i = 0; i < 2; i++) { key = &mds->mds_capa_keys[i]; DEBUG_CAPA_KEY(D_SEC, key, "propagate"); diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index 43507fd..e9fb4d9 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -805,6 +805,9 @@ test_50() { run_test 50 "failover MDS under load" test_51() { + #define OBD_FAIL_MDS_SYNC_CAPA_SL 0x1310 + do_facet ost1 lctl set_param fail_loc=0x00001310 + mkdir -p $DIR/$tdir # put a load of file creates/writes/deletes writemany -q $DIR/$tdir/$tfile 0 5 & -- 1.8.3.1