From 7ce25baf31572ceb2b1d2ff4b13b3958004c9a59 Mon Sep 17 00:00:00 2001 From: phil Date: Tue, 9 Dec 2003 16:26:16 +0000 Subject: [PATCH] b=2330 Add sanity test #62 for obd_match error checking, to avoid regression --- lustre/include/linux/obd_support.h | 1 + lustre/osc/osc_request.c | 6 ++++-- lustre/tests/sanity.sh | 12 ++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lustre/include/linux/obd_support.h b/lustre/include/linux/obd_support.h index 90b9612..71ff36b 100644 --- a/lustre/include/linux/obd_support.h +++ b/lustre/include/linux/obd_support.h @@ -116,6 +116,7 @@ extern unsigned int obd_sync_filter; #define OBD_FAIL_OSC_BRW_WRITE_BULK 0x402 #define OBD_FAIL_OSC_LOCK_BL_AST 0x403 #define OBD_FAIL_OSC_LOCK_CP_AST 0x404 +#define OBD_FAIL_OSC_MATCH 0x405 #define OBD_FAIL_PTLRPC 0x500 #define OBD_FAIL_PTLRPC_ACK 0x501 diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 8f0d319..0577cf2 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2211,8 +2211,8 @@ static int osc_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm, } static int osc_match(struct obd_export *exp, struct lov_stripe_md *lsm, - __u32 type, void *extentp, int extent_len, __u32 mode, - int *flags, void *data, struct lustre_handle *lockh) + __u32 type, void *extentp, int extent_len, __u32 mode, + int *flags, void *data, struct lustre_handle *lockh) { struct ldlm_res_id res_id = { .name = {lsm->lsm_object_id} }; struct obd_device *obd = exp->exp_obd; @@ -2220,6 +2220,8 @@ static int osc_match(struct obd_export *exp, struct lov_stripe_md *lsm, int rc; ENTRY; + OBD_FAIL_RETURN(OBD_FAIL_OSC_MATCH, -EIO); + /* Filesystem lock extents are extended to page boundaries so that * dealing with the page cache is a little smoother */ extent->start -= extent->start & ~PAGE_MASK; diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index c22504b..5b30118 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -1564,6 +1564,18 @@ test_61() { } run_test 61 "mmap() writes don't make sync hang ==========" +# bug 2330 - insufficient obd_match error checking causes LBUG +test_62() { + f="$DIR/f62" + echo foo > $f + cancel_lru_locks OSC + echo 0x405 > /proc/sys/lustre/fail_loc + cat $f && error # expect -EIO + multiop $f Owc && error + echo 0 > /proc/sys/lustre/fail_loc +} +run_test 62 "verify obd_match failure doesn't LBUG (should -EIO)" + # on the LLNL clusters, runas will still pick up root's $TMP settings, # which will not be writable for the runas user, and then you get a CVS # error message with a corrupt path string (CVS bug) and panic. -- 1.8.3.1