Whamcloud - gitweb
b=22273 Don't remove lcd in case of client_add failure
authorMikhail Pershin <tappro@sun.com>
Thu, 18 Mar 2010 17:21:28 +0000 (10:21 -0700)
committerRobert Read <rread@sun.com>
Thu, 18 Mar 2010 17:21:28 +0000 (10:21 -0700)
Let lcd be deleted naturally through export disconnect/destroy procedures

i=adilger
i=zam

lustre/include/obd_support.h
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_recovery.c
lustre/obdfilter/filter.c
lustre/tests/recovery-small.sh

index c93a200..a3be3a1 100644 (file)
@@ -359,6 +359,7 @@ int obd_alloc_fail(const void *ptr, const char *name, const char *type,
 #define OBD_FAIL_TGT_FAKE_EXP            0x708
 #define OBD_FAIL_TGT_REPLAY_DELAY        0x709
 #define OBD_FAIL_TGT_LAST_REPLAY         0x710
 #define OBD_FAIL_TGT_FAKE_EXP            0x708
 #define OBD_FAIL_TGT_REPLAY_DELAY        0x709
 #define OBD_FAIL_TGT_LAST_REPLAY         0x710
+#define OBD_FAIL_TGT_CLIENT_ADD          0x711
 
 #define OBD_FAIL_MDC_REVALIDATE_PAUSE    0x800
 #define OBD_FAIL_MDC_ENQUEUE_PAUSE       0x801
 
 #define OBD_FAIL_MDC_REVALIDATE_PAUSE    0x800
 #define OBD_FAIL_MDC_ENQUEUE_PAUSE       0x801
index ae0c669..2e3f2c1 100644 (file)
@@ -5024,14 +5024,11 @@ static int mdt_obd_connect(const struct lu_env *env,
                         memcpy(lcd->lcd_uuid, cluuid, sizeof lcd->lcd_uuid);
                         lexp->exp_mdt_data.med_lcd = lcd;
                         rc = mdt_client_new(env, mdt);
                         memcpy(lcd->lcd_uuid, cluuid, sizeof lcd->lcd_uuid);
                         lexp->exp_mdt_data.med_lcd = lcd;
                         rc = mdt_client_new(env, mdt);
-                        if (rc != 0) {
-                                OBD_FREE_PTR(lcd);
-                                lexp->exp_mdt_data.med_lcd = NULL;
-                        } else {
+                        if (rc == 0)
                                 mdt_export_stats_init(obd, lexp, localdata);
                                 mdt_export_stats_init(obd, lexp, localdata);
-                        }
-                } else
+                } else {
                         rc = -ENOMEM;
                         rc = -ENOMEM;
+                }
         }
 
 out:
         }
 
 out:
index f41651a..8f18207 100644 (file)
@@ -566,6 +566,10 @@ int mdt_client_new(const struct lu_env *env, struct mdt_device *mdt)
 
         /* Write new client data. */
         off = med->med_lr_off;
 
         /* Write new client data. */
         off = med->med_lr_off;
+
+        if (OBD_FAIL_CHECK(OBD_FAIL_TGT_CLIENT_ADD))
+                RETURN(-ENOSPC);
+
         mdt_trans_credit_init(env, mdt, MDT_TXN_LAST_RCVD_WRITE_OP);
 
         th = mdt_trans_start(env, mdt);
         mdt_trans_credit_init(env, mdt, MDT_TXN_LAST_RCVD_WRITE_OP);
 
         th = mdt_trans_start(env, mdt);
index 8043556..2e5806c 100644 (file)
@@ -366,6 +366,9 @@ static int filter_client_add(struct obd_device *obd, struct obd_export *exp,
                 CDEBUG(D_INFO, "writing client lcd at idx %u (%llu) (len %u)\n",
                        fed->fed_lr_idx,off,(unsigned int)sizeof(*fed->fed_lcd));
 
                 CDEBUG(D_INFO, "writing client lcd at idx %u (%llu) (len %u)\n",
                        fed->fed_lr_idx,off,(unsigned int)sizeof(*fed->fed_lcd));
 
+                if (OBD_FAIL_CHECK(OBD_FAIL_TGT_CLIENT_ADD))
+                        RETURN(-ENOSPC);
+
                 push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
                 /* Transaction needed to fix bug 1403 */
                 handle = fsfilt_start(obd,
                 push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
                 /* Transaction needed to fix bug 1403 */
                 handle = fsfilt_start(obd,
@@ -2820,10 +2823,6 @@ static int filter_connect(const struct lu_env *env,
 
 cleanup:
         if (rc) {
 
 cleanup:
         if (rc) {
-                if (lcd) {
-                        OBD_FREE_PTR(lcd);
-                        fed->fed_lcd = NULL;
-                }
                 class_disconnect(lexp);
                 lprocfs_exp_cleanup(lexp);
                 *exp = NULL;
                 class_disconnect(lexp);
                 lprocfs_exp_cleanup(lexp);
                 *exp = NULL;
index 8617876..023c14f 100755 (executable)
@@ -759,6 +759,26 @@ test_28() {      # bug 6086 - error adding new clients
 }
 run_test 28 "handle error adding new clients (bug 6086)"
 
 }
 run_test 28 "handle error adding new clients (bug 6086)"
 
+test_29a() { # bug 22273 - error adding new clients
+       #define OBD_FAIL_TGT_CLIENT_ADD 0x711
+       do_facet $SINGLEMDS "lctl set_param fail_loc=0x80000711"
+       # fail abort so client will be new again
+       fail_abort $SINGLEMDS
+       client_up || error "reconnect failed"
+       return 0
+}
+run_test 29a "error adding new clients doesn't cause LBUG (bug 22273)"
+
+test_29b() { # bug 22273 - error adding new clients
+       #define OBD_FAIL_TGT_CLIENT_ADD 0x711
+       do_facet ost1 "lctl set_param fail_loc=0x80000711"
+       # fail abort so client will be new again
+       fail_abort ost1
+       client_up || error "reconnect failed"
+       return 0
+}
+run_test 29b "error adding new clients doesn't cause LBUG (bug 22273)"
+
 test_50() {
        mkdir -p $DIR/$tdir
        # put a load of file creates/writes/deletes
 test_50() {
        mkdir -p $DIR/$tdir
        # put a load of file creates/writes/deletes