From 374462d3b68bcbf8ae6af2f8c0b5dd1961d3d46a Mon Sep 17 00:00:00 2001 From: ericm Date: Tue, 17 Mar 2009 16:08:53 +0000 Subject: [PATCH] branch: HEAD 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 | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 6d2b1ce..6c9fcab 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1031,8 +1031,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); } @@ -4002,8 +4000,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; } -- 1.8.3.1