Whamcloud - gitweb
Branch HEAD
authortappro <tappro>
Sun, 2 Aug 2009 09:25:09 +0000 (09:25 +0000)
committertappro <tappro>
Sun, 2 Aug 2009 09:25:09 +0000 (09:25 +0000)
b=18374
i=rread
i=johann

Port fixes and tests from 1.8 to the HEAD

lustre/include/obd_support.h
lustre/lov/lov_log.c
lustre/mdt/mdt_lib.c
lustre/tests/replay-single.sh

index 47dc072..59c591d 100644 (file)
@@ -203,6 +203,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,
 #define OBD_FAIL_MDS_DROP_QUOTA_REQ      0x13d
 #define OBD_FAIL_MDS_REMOVE_COMMON_EA    0x13e
 #define OBD_FAIL_MDS_ALLOW_COMMON_EA_SETTING   0x13f
+#define OBD_FAIL_MDS_FAIL_LOV_LOG_ADD    0x140
 #define OBD_FAIL_MDS_LOV_PREP_CREATE     0x141
 #define OBD_FAIL_MDS_REINT_DELAY         0x142
 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE    0x143
index 0300c02..7346f25 100644 (file)
@@ -74,7 +74,7 @@ static int lov_llog_origin_add(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
 {
         struct obd_device *obd = ctxt->loc_obd;
         struct lov_obd *lov = &obd->u.lov;
-        int i, rc = 0, rc1;
+        int i, rc = 0, cookies = 0;
         ENTRY;
 
         LASSERTF(logcookies && numcookies >= lsm->lsm_stripe_count,
@@ -111,15 +111,25 @@ static int lov_llog_origin_add(struct llog_ctxt *ctxt, struct llog_rec_hdr *rec,
                         break;
                 }
                 LASSERT(lsm->lsm_object_gr == loi->loi_gr);
-                rc1 = llog_add(cctxt, rec, NULL, logcookies + rc,
-                               numcookies - rc);
+                /* inject error in llog_add() below */
+                if (OBD_FAIL_CHECK(OBD_FAIL_MDS_FAIL_LOV_LOG_ADD)) {
+                        llog_ctxt_put(cctxt);
+                        cctxt = NULL;
+                }
+                rc = llog_add(cctxt, rec, NULL, logcookies + cookies,
+                               numcookies - cookies);
                 llog_ctxt_put(cctxt);
-                if (rc1 < 0)
-                        RETURN(rc1);
-                rc += rc1;
+                if (rc < 0) {
+                        CERROR("Can't add llog (rc = %d) for stripe %i\n",
+                               rc, cookies);
+                        memset(logcookies + cookies, 0,
+                               sizeof(struct llog_cookie));
+                        rc = 1; /* skip this cookie */
+                }
+                /* Note that rc is always 1 if llog_add was successful */
+                cookies += rc;
         }
-
-        RETURN(rc);
+        RETURN(cookies);
 }
 
 static int lov_llog_origin_connect(struct llog_ctxt *ctxt,
index fdd6aea..e95f2c7 100644 (file)
@@ -1131,6 +1131,9 @@ static int mdt_rename_unpack(struct mdt_thread_info *info)
         else
                 ma->ma_attr_flags &= ~MDS_VTX_BYPASS;
 
+        if (lustre_msg_get_flags(mdt_info_req(info)->rq_reqmsg) & MSG_REPLAY)
+                info->mti_spec.no_create = 1;
+
         rc = mdt_dlmreq_unpack(info);
         RETURN(rc);
 }
index c6ebf69..1b789e0 100755 (executable)
@@ -1998,16 +1998,36 @@ test_82b() {
 }
 run_test 82b "CMD: mkdir cross-node dir (fail mds with name)"
 
-test_84() {
+test_83a() {
+    mkdir -p $DIR/$tdir
+    createmany -o $DIR/$tdir/$tfile- 10 || return 1
+#define OBD_FAIL_MDS_FAIL_LOV_LOG_ADD       0x140
+    do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000140"
+    unlinkmany $DIR/$tdir/$tfile- 10 || return 2
+}
+run_test 83a "fail log_add during unlink recovery"
+
+test_83b() {
+    mkdir -p $DIR/$tdir
+    createmany -o $DIR/$tdir/$tfile- 10 || return 1
+    replay_barrier $SINGLEMDS
+    unlinkmany $DIR/$tdir/$tfile- 10 || return 2
+#define OBD_FAIL_MDS_FAIL_LOV_LOG_ADD       0x140
+    do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000140"
+    fail $SINGLEMDS
+}
+run_test 83b "fail log_add during unlink recovery"
+
+test_84a() {
 #define OBD_FAIL_MDS_OPEN_WAIT_CREATE  0x143
-    do_facet mds "lctl set_param fail_loc=0x80000143"
+    do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000143"
     createmany -o $DIR/$tfile- 1 &
     PID=$!
     mds_evict_client
     wait $PID
     df -P $DIR || df -P $DIR || true    # reconnect
 }
-run_test 84 "stale open during export disconnect"
+run_test 84a "stale open during export disconnect"
 
 equals_msg `basename $0`: test complete, cleaning up
 check_and_cleanup_lustre