From c866e2ad4b5fa0e512d1dc7135f37b59f3544205 Mon Sep 17 00:00:00 2001 From: Jadhav Vikram Date: Thu, 8 Jun 2017 23:11:38 +0530 Subject: [PATCH] LU-9620 tests: test race between pool_list and pool_remove Test ost-pools/test_27 added to test race between pool_list and pool_remove. Change-Id: I8497836dd6e8b2c20ade3626b7a1f84b98f3a94f Seagate-bug-id: MRP-3629 Signed-off-by: Jadhav Vikram Reviewed-by: Ashish Purkar Reviewed-by: Andriy Skulysh Tested-by: Elena V. Gryaznova Reviewed-on: https://review.whamcloud.com/27505 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- lustre/include/obd_support.h | 1 + lustre/lod/lod_pool.c | 2 ++ lustre/tests/ost-pools.sh | 31 +++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 433c2f8..3d1dae7 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -326,6 +326,7 @@ extern char obd_jobid_var[]; #define OBD_FAIL_OST_PAUSE_PUNCH 0x236 #define OBD_FAIL_OST_LADVISE_PAUSE 0x237 #define OBD_FAIL_OST_FAKE_RW 0x238 +#define OBD_FAIL_OST_LIST_ASSERT 0x239 #define OBD_FAIL_LDLM 0x300 #define OBD_FAIL_LDLM_NAMESPACE_NEW 0x301 diff --git a/lustre/lod/lod_pool.c b/lustre/lod/lod_pool.c index df66bb3..1b15f6c 100644 --- a/lustre/lod/lod_pool.c +++ b/lustre/lod/lod_pool.c @@ -260,6 +260,8 @@ static void *pool_proc_next(struct seq_file *seq, void *v, loff_t *pos) if (*pos >= pool_tgt_count(iter->lpi_pool)) return NULL; + OBD_FAIL_TIMEOUT(OBD_FAIL_OST_LIST_ASSERT, cfs_fail_val); + /* iterate to find a non empty entry */ prev_idx = iter->lpi_idx; iter->lpi_idx++; diff --git a/lustre/tests/ost-pools.sh b/lustre/tests/ost-pools.sh index 5dd539a..4cfbe9f 100755 --- a/lustre/tests/ost-pools.sh +++ b/lustre/tests/ost-pools.sh @@ -1513,6 +1513,37 @@ test_26() { } run_test 26 "Choose other OSTs in the pool first in the creation remedy" +test_27() { + [[ $OSTCOUNT -le 1 ]] && skip_env "Need at least 2 OSTs" && return + + local osts + local pid + local count=$OSTCOUNT + + create_pool_nofail $POOL + do_facet mgs lctl pool_add $FSNAME.$POOL $TGT_ALL + osts=$(list_pool $FSNAME.$POOL) + for ost in ${osts}; do + ((count--)) + if [[ $count -eq 0 ]]; then + #define OBD_FAIL_OST_LIST_ASSERT 0x239 + do_facet $SINGLEMDS \ + $LCTL set_param fail_loc=0x239 fail_val=10 + list_pool $FSNAME.$POOL & + pid=$! + sleep 5 + do_facet $SINGLEMDS $LCTL set_param fail_loc=0 + do_facet mgs $LCTL pool_remove $FSNAME.$POOL $ost + wait $pid + do_facet $SINGLEMDS $LCTL set_param fail_val=0 + else + do_facet mgs $LCTL pool_remove $FSNAME.$POOL $ost + fi + done + destroy_pool $POOL +} +run_test 27 "Race pool_list and pool_remove" + cd $ORIG_PWD complete $SECONDS -- 1.8.3.1