From 9812260ca4296c198ad7bc63f1a64718f159597b Mon Sep 17 00:00:00 2001 From: Andriy Skulysh Date: Fri, 13 Jan 2012 16:08:57 +0200 Subject: [PATCH] LU-989 ldlm: Fix client's import destruction Move client's import destruction from disconnect to cleanup phase The patch allows to use connect after disconnect. Xyratex-bug-id: MRP-288 Signed-off-by: Andriy Skulysh Reviewed-by: Alexey Lyashkov Reviewed-by: Vitaly Fertman Signed-off-by: Bob Glossman Change-Id: I0a63f66205ac5931ead0acea492f3e480669e237 Reviewed-on: http://review.whamcloud.com/2664 Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/include/obd_class.h | 2 +- lustre/ldlm/ldlm_lib.c | 10 +++------- lustre/obdclass/genops.c | 1 + 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 145d26c..07d246c 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -637,7 +637,7 @@ static inline void obd_cleanup_client_import(struct obd_device *obd) ptlrpc_free_rq_pool(imp->imp_rq_pool); imp->imp_rq_pool = NULL; } - class_destroy_import(imp); + client_destroy_import(imp); obd->u.cli.cl_import = NULL; } cfs_up_write(&obd->u.cli.cl_sem); diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 78c08e8..d71a755 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -227,6 +227,7 @@ void client_destroy_import(struct obd_import *imp) sptlrpc_import_sec_put(imp); class_import_put(imp); } +EXPORT_SYMBOL(client_destroy_import); /* configure an RPC client OBD device * @@ -429,6 +430,8 @@ int client_obd_cleanup(struct obd_device *obddev) ldlm_namespace_free_post(obddev->obd_namespace); obddev->obd_namespace = NULL; + LASSERT(obddev->u.cli.cl_import == NULL); + ldlm_put_ref(); RETURN(0); } @@ -561,13 +564,6 @@ int client_disconnect_export(struct obd_export *exp) ptlrpc_invalidate_import(imp); - if (imp->imp_rq_pool) { - ptlrpc_free_rq_pool(imp->imp_rq_pool); - imp->imp_rq_pool = NULL; - } - client_destroy_import(imp); - cli->cl_import = NULL; - EXIT; out_disconnect: diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 55c616c..311e186 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -1583,6 +1583,7 @@ static void obd_zombie_export_add(struct obd_export *exp) { */ static void obd_zombie_import_add(struct obd_import *imp) { LASSERT(imp->imp_sec == NULL); + LASSERT(imp->imp_rq_pool == NULL); cfs_spin_lock(&obd_zombie_impexp_lock); LASSERT(cfs_list_empty(&imp->imp_zombie_chain)); zombies_count++; -- 1.8.3.1