Whamcloud - gitweb
don't leak obd reference on failed llog setup
authorshadow <shadow>
Tue, 31 Mar 2009 07:22:50 +0000 (07:22 +0000)
committershadow <shadow>
Tue, 31 Mar 2009 07:22:50 +0000 (07:22 +0000)
Branch b_release_1_8_0
b=18896
i=tappro
i=rread

lustre/ChangeLog
lustre/ldlm/ldlm_lib.c
lustre/mdc/mdc_request.c
lustre/osc/osc_request.c

index 06d058a..28fae72 100644 (file)
          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
index 531ceb1..d5bb2b9 100644 (file)
@@ -366,7 +366,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);
 }
index 5f5742e..724c3aa 100644 (file)
@@ -1376,9 +1376,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)
index 5d438d4..c0ccd2a 100644 (file)
@@ -4033,19 +4033,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)
@@ -4063,6 +4054,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;
@@ -4078,6 +4070,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();