From: Mikhail Pershin Date: Thu, 18 Mar 2010 17:21:28 +0000 (-0700) Subject: b=22273 Don't remove lcd in case of client_add failure X-Git-Tag: 1.10.0.39~49 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=721e945a96186dba1ddd5ef4b2cab8cd8c4e06c2;ds=sidebyside b=22273 Don't remove lcd in case of client_add failure Let lcd be deleted naturally through export disconnect/destroy procedures i=adilger i=zam --- diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index c93a200..a3be3a1 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -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_CLIENT_ADD 0x711 #define OBD_FAIL_MDC_REVALIDATE_PAUSE 0x800 #define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801 diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index ae0c669..2e3f2c1 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -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); - 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); - } - } else + } else { rc = -ENOMEM; + } } out: diff --git a/lustre/mdt/mdt_recovery.c b/lustre/mdt/mdt_recovery.c index f41651a..8f18207 100644 --- a/lustre/mdt/mdt_recovery.c +++ b/lustre/mdt/mdt_recovery.c @@ -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; + + 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); diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 8043556..2e5806c 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -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)); + 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, @@ -2820,10 +2823,6 @@ static int filter_connect(const struct lu_env *env, cleanup: if (rc) { - if (lcd) { - OBD_FREE_PTR(lcd); - fed->fed_lcd = NULL; - } class_disconnect(lexp); lprocfs_exp_cleanup(lexp); *exp = NULL; diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index 8617876..023c14f 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -759,6 +759,26 @@ test_28() { # bug 6086 - error adding new clients } 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