From: Alexey Lyashkov MRP-3623 test: long waiting for multi stripe file Sometimes we may fail a second or next stripe in file, so need to check system is non blocked. Signed-off-by: Alexey Lyashkov Change-Id: I7dc2986133667a09e6788720657e54a8f5ec5107 --- lustre/include/obd_support.h | 3 +++ lustre/osp/osp_precreate.c | 2 ++ lustre/tests/recovery-small.sh | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index e84684a..26e1004 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -535,6 +535,9 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type, #define OBD_FAIL_UPDATE_OBJ_NET 0x1700 #define OBD_FAIL_UPDATE_OBJ_NET_REP 0x1701 +/* OSP */ +#define OBD_FAIL_OSP_PRECREATE_WAIT 0x1800 + /* DT */ #define OBD_FAIL_DT_DECLARE_ATTR_GET 0x2000 #define OBD_FAIL_DT_ATTR_GET 0x2001 diff --git a/lustre/osp/osp_precreate.c b/lustre/osp/osp_precreate.c index 669aadc..e6ac6d1 100644 --- a/lustre/osp/osp_precreate.c +++ b/lustre/osp/osp_precreate.c @@ -1058,6 +1058,8 @@ int osp_precreate_reserve(const struct lu_env *env, struct osp_device *d) "Next FID "DFID"\n", PFID(&d->opd_pre_last_created_fid), PFID(&d->opd_pre_used_fid)); + CFS_FAIL_TIMEOUT(OBD_FAIL_OSP_PRECREATE_WAIT, obd_timeout); + /* * wait till: * - preallocation is done diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index a7aa01f..be7274c 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -2369,6 +2369,38 @@ test_131() { } run_test 131 "IO vs evict results to IO under staled lock" +test_132a() { + local file + local pid + + test_mkdir -p $DIR/$tdir + file="$DIR/$tdir/file" + + $SETSTRIPE -i 0 -c -1 $DIR/$tdir || error "setstripe failed" + $LFS getstripe $DIR/$tdir + #define OBD_FAIL_OSP_PRECREATE_WAIT 0x1800 | FAIL_SKIP + do_facet $SINGLEMDS \ + "lctl set_param fail_loc=0x20001800 fail_val=1" + + dd if=/dev/zero of=$file count=1 oflag=sync & + pid=$! + sleep $(( $TIMEOUT / 4 )) + + local osp2dev=$(do_facet $SINGLEMDS "lctl get_param -n devices" | grep ${ost1_svc}-osc-MDT0000 | awk '{print $1}') + do_facet $SINGLEMDS $LCTL --device $osp2dev deactivate || return 3 + do_facet $SINGLEMDS $LCTL --device $osp2dev activate || return 4 + # just enough to connect finish + sleep 2 + local block=$(do_facet $SINGLEMDS "ps --no-headers -o pid -C osp-pre-0 | xargs -I {} grep --no-filename -c osp_precreate_cleanup_orphans /proc/{}/stack ") + echo "precreate blocked $block" + [ $block -eq 0 ] || return 5 + + wait $pid || error "dd failed" + + return 0; +} +run_test 132a "MDT<>OST recovery don't blocked on mutistripe file" + complete $SECONDS check_and_cleanup_lustre exit_status