Whamcloud - gitweb
b=2330
authorphil <phil>
Tue, 9 Dec 2003 16:26:16 +0000 (16:26 +0000)
committerphil <phil>
Tue, 9 Dec 2003 16:26:16 +0000 (16:26 +0000)
Add sanity test #62 for obd_match error checking, to avoid regression

lustre/include/linux/obd_support.h
lustre/osc/osc_request.c
lustre/tests/sanity.sh

index 90b9612..71ff36b 100644 (file)
@@ -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
index 8f0d319..0577cf2 100644 (file)
@@ -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;
index c22504b..5b30118 100644 (file)
@@ -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.