From: Di Wang Date: Thu, 8 Oct 2015 23:15:29 +0000 (-0700) Subject: LU-7039 tgt: Delete txn_callback correctly in tgt_init() X-Git-Tag: 2.7.63~48 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=44e9ec0b46fc46cc72bebbdc35e4a59a0397a81c;p=fs%2Flustre-release.git LU-7039 tgt: Delete txn_callback correctly in tgt_init() txn_callback should only be deleted after initialization. Signed-off-by: wang di Change-Id: Ifdfabe6439c1413d02782d0dfe7a14d6b82ed0df Reviewed-on: http://review.whamcloud.com/16797 Tested-by: Jenkins Reviewed-by: Mike Pershin Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/target/tgt_main.c b/lustre/target/tgt_main.c index c2b518f..94caf3a 100644 --- a/lustre/target/tgt_main.c +++ b/lustre/target/tgt_main.c @@ -98,13 +98,13 @@ int tgt_init(const struct lu_env *env, struct lu_target *lut, rc = PTR_ERR(o); CERROR("%s: cannot open LAST_RCVD: rc = %d\n", tgt_name(lut), rc); - GOTO(out, rc); + GOTO(out_put, rc); } lut->lut_last_rcvd = o; rc = tgt_server_data_init(env, lut); if (rc < 0) - GOTO(out, rc); + GOTO(out_put, rc); /* prepare transactions callbacks */ lut->lut_txn_cb.dtc_txn_start = tgt_txn_start_cb; @@ -147,12 +147,14 @@ int tgt_init(const struct lu_env *env, struct lu_target *lut, GOTO(out, rc); RETURN(0); + out: + dt_txn_callback_del(lut->lut_bottom, &lut->lut_txn_cb); +out_put: if (lut->lut_last_rcvd != NULL) { lu_object_put(env, &lut->lut_last_rcvd->do_lu); - dt_txn_callback_del(lut->lut_bottom, &lut->lut_txn_cb); + lut->lut_last_rcvd = NULL; } - lut->lut_last_rcvd = NULL; if (lut->lut_client_bitmap != NULL) OBD_FREE(lut->lut_client_bitmap, LR_MAX_CLIENTS >> 3); lut->lut_client_bitmap = NULL;