From 5023ca334069950ccece06db3c12104232b5ab71 Mon Sep 17 00:00:00 2001 From: Bruno Faccini Date: Fri, 20 Nov 2015 15:38:11 +0100 Subject: [PATCH] LU-5921 tests: enhance server target mount race testing This patch is a follow on to LU-5299 to strengthen and enhance concurrent server target mount race testing. It uses OBD_RACE() feature to better set a concurrent/racy situation, and also allow to handle all mount errors instead of only EALREADY. Signed-off-by: Bruno Faccini Change-Id: I16a94e5aa046e15096d2e55d57e22899a93fa03f Reviewed-on: http://review.whamcloud.com/17302 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin --- lustre/include/obd_support.h | 1 + lustre/obdclass/obd_mount_server.c | 5 +++-- lustre/tests/conf-sanity.sh | 30 ++++++++++++++---------------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index a537840..88e4a07 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -438,6 +438,7 @@ extern char obd_jobid_var[]; #define OBD_FAIL_TGT_DELAY_CONDITIONAL 0x713 #define OBD_FAIL_TGT_REPLAY_DELAY2 0x714 #define OBD_FAIL_TGT_REPLAY_RECONNECT 0x715 +#define OBD_FAIL_TGT_MOUNT_RACE 0x716 #define OBD_FAIL_MDC_REVALIDATE_PAUSE 0x800 #define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801 diff --git a/lustre/obdclass/obd_mount_server.c b/lustre/obdclass/obd_mount_server.c index e62475c..7f2e33a 100644 --- a/lustre/obdclass/obd_mount_server.c +++ b/lustre/obdclass/obd_mount_server.c @@ -1715,8 +1715,6 @@ static int osd_start(struct lustre_sb_info *lsi, unsigned long mflags) rc = obd_connect(NULL, &lsi->lsi_osd_exp, obd, &obd->obd_uuid, NULL, NULL); - OBD_FAIL_TIMEOUT(OBD_FAIL_TGT_DELAY_CONNECT, 10); - if (rc) { obd->obd_force = 1; class_manual_cleanup(obd); @@ -1749,6 +1747,9 @@ int server_fill_super(struct super_block *sb) int rc; ENTRY; + /* to simulate target mount race */ + OBD_RACE(OBD_FAIL_TGT_MOUNT_RACE); + rc = lsi_prepare(lsi); if (rc) RETURN(rc); diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 3fe0aa3..41909f1 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -2763,23 +2763,22 @@ test_41c() { cleanup # MDT concurrent start - #define OBD_FAIL_TGT_DELAY_CONNECT 0x703 - do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x703" + #define OBD_FAIL_TGT_MOUNT_RACE 0x716 + do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x716" start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS & local pid=$! - sleep 2 - do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x0" start mds1 $(mdsdevname 1) $MDS_MOUNT_OPTS & + do_facet $SINGLEMDS "$LCTL set_param fail_loc=0x0" local pid2=$! wait $pid2 local rc2=$? wait $pid local rc=$? - if [ $rc == 0 ] && [ $rc2 == 114 ]; then + if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then echo "1st MDT start succeed" - echo "2nd MDT start failed with EALREADY" - elif [ $rc2 == 0 ] && [ $rc == 114 ]; then - echo "1st MDT start failed with EALREADY" + echo "2nd MDT start failed with $rc2" + elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then + echo "1st MDT start failed with $rc" echo "2nd MDT start succeed" else stop mds1 -f @@ -2794,23 +2793,22 @@ test_41c() { # OST concurrent start - #define OBD_FAIL_TGT_DELAY_CONNECT 0x703 - do_facet ost1 "$LCTL set_param fail_loc=0x703" + #define OBD_FAIL_TGT_MOUNT_RACE 0x716 + do_facet ost1 "$LCTL set_param fail_loc=0x716" start ost1 $(ostdevname 1) $OST_MOUNT_OPTS & pid=$! - sleep 2 - do_facet ost1 "$LCTL set_param fail_loc=0x0" start ost1 $(ostdevname 1) $OST_MOUNT_OPTS & + do_facet ost1 "$LCTL set_param fail_loc=0x0" pid2=$! wait $pid2 rc2=$? wait $pid rc=$? - if [ $rc == 0 ] && [ $rc2 == 114 ]; then + if [ $rc -eq 0 ] && [ $rc2 -ne 0 ]; then echo "1st OST start succeed" - echo "2nd OST start failed with EALREADY" - elif [ $rc2 == 0 ] && [ $rc == 114 ]; then - echo "1st OST start failed with EALREADY" + echo "2nd OST start failed with $rc2" + elif [ $rc2 -eq 0 ] && [ $rc -ne 0 ]; then + echo "1st OST start failed with $rc" echo "2nd OST start succeed" else stop_mds -f -- 1.8.3.1