From 5aa4b08d5d3ff416340f8acda5123d9f26bedefe Mon Sep 17 00:00:00 2001 From: fanyong Date: Tue, 5 Dec 2006 15:30:38 +0000 Subject: [PATCH] Port from b1_5, cleanup the client import manually if no connect to mdt/ost. (found when client mount failed for permission) --- lustre/mdc/mdc_request.c | 11 +++++++++++ lustre/osc/osc_request.c | 14 +++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index bb22de4..84218e7 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -1496,6 +1496,17 @@ static int mdc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage) switch (stage) { case OBD_CLEANUP_EARLY: case OBD_CLEANUP_EXPORTS: + /* 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; + imp = obd->u.cli.cl_import; + CERROR("client import never connected\n"); + ptlrpc_invalidate_import(imp); + ptlrpc_free_rq_pool(imp->imp_rq_pool); + class_destroy_import(imp); + obd->u.cli.cl_import = NULL; + } break; case OBD_CLEANUP_SELF_EXP: rc = obd_llog_finish(obd, 0); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 5c1355f..623e1f2 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -3487,8 +3487,20 @@ static int osc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage) ptlrpc_deactivate_import(imp); break; } - case OBD_CLEANUP_EXPORTS: + case OBD_CLEANUP_EXPORTS: { + /* 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; + imp = obd->u.cli.cl_import; + CERROR("client import never connected\n"); + ptlrpc_invalidate_import(imp); + ptlrpc_free_rq_pool(imp->imp_rq_pool); + class_destroy_import(imp); + obd->u.cli.cl_import = NULL; + } break; + } case OBD_CLEANUP_SELF_EXP: rc = obd_llog_finish(obd, 0); if (rc != 0) -- 1.8.3.1