From: shadow Date: Fri, 20 Mar 2009 22:08:02 +0000 (+0000) Subject: don't leak lov_lock if adding to global ost pool is failed. X-Git-Tag: v1_8_0_110~166 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=66b5b3a60011ea3590bcd09aa0e1fd90f4ac103e;p=fs%2Flustre-release.git don't leak lov_lock if adding to global ost pool is failed. Branch b1_8 b=18868 i=johann i=tappro --- diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 83ebeec..4c76dae 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -650,6 +650,13 @@ static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp, RETURN(-ENOMEM); } + rc = lov_ost_pool_add(&lov->lov_packed, index, lov->lov_tgt_size); + if (rc) { + mutex_up(&lov->lov_lock); + OBD_FREE_PTR(tgt); + RETURN(rc); + } + memset(tgt, 0, sizeof(*tgt)); tgt->ltd_uuid = *uuidp; /* XXX - add a sanity check on the generation number. */ @@ -660,10 +667,6 @@ static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp, if (index >= lov->desc.ld_tgt_count) lov->desc.ld_tgt_count = index + 1; - rc = lov_ost_pool_add(&lov->lov_packed, index, lov->lov_tgt_size); - if (rc) - RETURN(rc); - mutex_up(&lov->lov_lock); CDEBUG(D_CONFIG, "idx=%d ltd_gen=%d ld_tgt_count=%d\n", @@ -689,12 +692,12 @@ static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp, rc = lov_notify(obd, tgt->ltd_exp->exp_obd, active ? OBD_NOTIFY_CONNECT : OBD_NOTIFY_INACTIVE, (void *)&index); - out: if (rc) { - CERROR("add failed (%d), deleting %s\n", rc, + /* connect or notify failed - we can try connect later + * instead of complete delete target */ + CERROR("connect or notify failed (%d) for %s\n", rc, obd_uuid2str(&tgt->ltd_uuid)); - lov_del_target(obd, index, 0, 0); } lov_putref(obd); RETURN(rc);