Whamcloud - gitweb
LU-6033 tests: inject failure before counting the objects 98/13098/4
authorFan Yong <fan.yong@intel.com>
Thu, 9 Oct 2014 09:36:11 +0000 (17:36 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 29 Dec 2014 17:21:12 +0000 (17:21 +0000)
Some test cases need to inject some failure stub on OST that will
be triggered when creating the OST objects. For that, we need to
calculate how many objects to be created to guarantee that all the
pre-created OST-objects on the MDT can be exhausted. Under some
race cases, the MDT may be in pre-creating OST-objects and finished
the pre-creation just after the precreated_ost_obj_count() returning
zero to the caller but before the caller injecting the failure stub
on the OST. Then the subsequent failure injection will be useless.
To resolve such trouble, the caller of precreated_ost_obj_count()
should inject related failure stub before calculating the pre-created
OST-objects count.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I01c98c0eb67aa0974c3223356557ae76f23ddb77
Reviewed-on: http://review.whamcloud.com/13098
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity-lfsck.sh
lustre/tests/sanity-scrub.sh
lustre/tests/test-framework.sh

index d725d64..2d971ce 100644 (file)
@@ -1419,11 +1419,11 @@ test_14() {
        check_mount_and_prep
        $LFS setstripe -c 1 -i 0 $DIR/$tdir
 
-       local count=$(precreated_ost_obj_count 0 0)
-
        echo "Inject failure stub to simulate dangling referenced MDT-object"
        #define OBD_FAIL_LFSCK_DANGLING 0x1610
        do_facet ost1 $LCTL set_param fail_loc=0x1610
+       local count=$(precreated_ost_obj_count 0 0)
+
        createmany -o $DIR/$tdir/f $((count + 31))
        touch $DIR/$tdir/guard
        do_facet ost1 $LCTL set_param fail_loc=0
index 14440d9..79e1437 100644 (file)
@@ -987,12 +987,11 @@ test_12() {
        check_mount_and_prep
        $SETSTRIPE -c 1 -i 0 $DIR/$tdir
 
-       local count=$(precreated_ost_obj_count 0 0)
-
        #define OBD_FAIL_OSD_COMPAT_INVALID_ENTRY               0x195
        do_facet ost1 $LCTL set_param fail_loc=0x195
-       createmany -o $DIR/$tdir/f $((count + 32))
+       local count=$(precreated_ost_obj_count 0 0)
 
+       createmany -o $DIR/$tdir/f $((count + 32))
        umount_client $MOUNT || error "(1) Fail to stop client!"
 
        stop ost1 || error "(2) Fail to stop ost1"
@@ -1026,10 +1025,10 @@ test_13() {
        check_mount_and_prep
        $SETSTRIPE -c 1 -i 0 $DIR/$tdir
 
-       local count=$(precreated_ost_obj_count 0 0)
-
        #define OBD_FAIL_OSD_COMPAT_NO_ENTRY            0x196
        do_facet ost1 $LCTL set_param fail_loc=0x196
+       local count=$(precreated_ost_obj_count 0 0)
+
        createmany -o $DIR/$tdir/f $((count + 32))
        do_facet ost1 $LCTL set_param fail_loc=0
 
@@ -1059,10 +1058,10 @@ test_14() {
        check_mount_and_prep
        $SETSTRIPE -c 1 -i 0 $DIR/$tdir
 
-       local count=$(precreated_ost_obj_count 0 0)
-
        #define OBD_FAIL_OSD_COMPAT_NO_ENTRY            0x196
        do_facet ost1 $LCTL set_param fail_loc=0x196
+       local count=$(precreated_ost_obj_count 0 0)
+
        createmany -o $DIR/$tdir/f $((count + 32))
        do_facet ost1 $LCTL set_param fail_loc=0
 
index 3388723..6d52df9 100755 (executable)
@@ -6997,11 +6997,10 @@ precreated_ost_obj_count()
        local mdt_name="MDT$(printf '%04x' $mdt_idx)"
        local ost_name="OST$(printf '%04x' $ost_idx)"
        local proc_path="${FSNAME}-${ost_name}-osc-${mdt_name}"
-       local last_id=$(do_facet mds${mdt_idx} lctl get_param -n \
+       local last_id=$(do_facet mds$((mdt_idx + 1)) lctl get_param -n \
                        osp.$proc_path.prealloc_last_id)
-       local next_id=$(do_facet mds${mdt_idx} lctl get_param -n \
+       local next_id=$(do_facet mds$((mdt_idx + 1)) lctl get_param -n \
                        osp.$proc_path.prealloc_next_id)
-
        echo $((last_id - next_id + 1))
 }