From f747d6e7cad3e4ca2dda2b711574fab223c271cd Mon Sep 17 00:00:00 2001 From: shadow Date: Tue, 31 Mar 2009 07:20:38 +0000 Subject: [PATCH] don't leak obd reference on failed llog setup Branch b1_6 b=18896 i=tappro i=rread --- lustre/ChangeLog | 7 +++++++ lustre/ldlm/ldlm_lib.c | 6 ++++++ lustre/mdc/mdc_request.c | 2 -- lustre/osc/osc_request.c | 17 +++++++---------- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 30d9672..8618d5e 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -45,6 +45,13 @@ tbd Sun Microsystems, Inc. more information, please refer to bugzilla 17630. Severity : normal +Frequency : rare, on failed llog setup +Bugzilla : 18896 +Descriptoin: don't leak obd reference on failed llog setup +Details : for failed llog setup - mgc forget call class_destroy_import for + client import, move destroy import to more generic place. + +Severity : normal Frequency : rare Bugzilla : 18902 Descriptoin: allow kill process which wait statahead result diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index a05831c..e5a8d15 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -361,7 +361,13 @@ err: int client_obd_cleanup(struct obd_device *obddev) { + struct client_obd *cli = &obddev->u.cli; ENTRY; + + /* cleanup can be called for never connected obd */ + if (cli->cl_import) + class_destroy_import(cli->cl_import); + ldlm_put_ref(); RETURN(0); } diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index e5bc0b2..1990b84 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -1267,9 +1267,7 @@ static int mdc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage) imp = obd->u.cli.cl_import; CERROR("client import never connected\n"); ptlrpc_invalidate_import(imp); - class_destroy_import(imp); up_write(&obd->u.cli.cl_sem); - obd->u.cli.cl_import = NULL; } rc = obd_llog_finish(obd, 0); if (rc != 0) diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 2c49532..7e9907f 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -4140,19 +4140,10 @@ static int osc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage) /* If we set up but never connected, the client import will not have been cleaned. */ if (obd->u.cli.cl_import) { - struct obd_import *imp; - down_write(&obd->u.cli.cl_sem); - imp = obd->u.cli.cl_import; + struct obd_import *imp = obd->u.cli.cl_import; CDEBUG(D_CONFIG, "%s: client import never connected\n", obd->obd_name); ptlrpc_invalidate_import(imp); - if (imp->imp_rq_pool) { - ptlrpc_free_rq_pool(imp->imp_rq_pool); - imp->imp_rq_pool = NULL; - } - class_destroy_import(imp); - up_write(&obd->u.cli.cl_sem); - obd->u.cli.cl_import = NULL; } rc = obd_llog_finish(obd, 0); if (rc != 0) @@ -4170,6 +4161,7 @@ static int osc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage) int osc_cleanup(struct obd_device *obd) { struct osc_creator *oscc = &obd->u.cli.cl_oscc; + struct obd_import *imp = obd->u.cli.cl_import; int rc; ENTRY; @@ -4185,6 +4177,11 @@ int osc_cleanup(struct obd_device *obd) lquota_cleanup(quota_interface, obd); cache_destroy(obd->u.cli.cl_cache); + if (imp && imp->imp_rq_pool) { + ptlrpc_free_rq_pool(imp->imp_rq_pool); + imp->imp_rq_pool = NULL; + } + rc = client_obd_cleanup(obd); ptlrpcd_decref(); -- 1.8.3.1