Whamcloud - gitweb
branch: b1_8
authorericm <ericm>
Tue, 17 Mar 2009 16:08:09 +0000 (16:08 +0000)
committerericm <ericm>
Tue, 17 Mar 2009 16:08:09 +0000 (16:08 +0000)
patch from wangdi: cleanup shrink_grant callbacks only after client import
has been destroied.
b=18662
o=wangdi
r=ericm
r=huanghua

lustre/osc/osc_request.c

index 16aca44..60def2c 100644 (file)
@@ -957,8 +957,6 @@ static int osc_add_shrink_grant(struct client_obd *client)
 
 static int osc_del_shrink_grant(struct client_obd *client)
 {
-        CDEBUG(D_CACHE, "del grant client %s \n", 
-               client->cl_import->imp_obd->obd_name);
         return ptlrpc_del_timeout_client(&client->cl_grant_shrink_list);
 }
 
@@ -4048,8 +4046,26 @@ static int osc_disconnect(struct obd_export *exp)
                        obd);
         }
 
-        osc_del_shrink_grant(&obd->u.cli);
         rc = client_disconnect_export(exp);
+        /**
+         * Initially we put del_shrink_grant before disconnect_export, but it
+         * causes the following problem if setup (connect) and cleanup
+         * (disconnect) are tangled together.
+         *      connect p1                     disconnect p2
+         *   ptlrpc_connect_import 
+         *     ...............               class_manual_cleanup
+         *                                     osc_disconnect
+         *                                     del_shrink_grant
+         *   ptlrpc_connect_interrupt
+         *     init_grant_shrink
+         *   add this client to shrink list                 
+         *                                      cleanup_osc
+         * Bang! pinger trigger the shrink.
+         * So the osc should be disconnected from the shrink list, after we
+         * are sure the import has been destroyed. BUG18662 
+         */
+        if (obd->u.cli.cl_import == NULL)
+                osc_del_shrink_grant(&obd->u.cli);
         return rc;
 }