Whamcloud - gitweb
revert fix
authorshadow <shadow>
Tue, 14 Apr 2009 18:43:54 +0000 (18:43 +0000)
committershadow <shadow>
Tue, 14 Apr 2009 18:43:54 +0000 (18:43 +0000)
b=16839

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

index 8cf7c20..b8e5fd6 100644 (file)
@@ -361,13 +361,7 @@ 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 26a5090..8cf77b3 100644 (file)
@@ -1466,7 +1466,9 @@ 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 6c57b9c..df93f5e 100644 (file)
@@ -4264,10 +4264,19 @@ 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 = obd->u.cli.cl_import;
+                        struct obd_import *imp;
+                        down_write(&obd->u.cli.cl_sem);
+                        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)
@@ -4285,7 +4294,6 @@ 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;
@@ -4301,11 +4309,6 @@ 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();