From b09c3d96f881a7b574b47516ea0452d47959763c Mon Sep 17 00:00:00 2001 From: shaver Date: Sat, 20 Sep 2003 16:51:06 +0000 Subject: [PATCH] b=1896: Two fixes, both required for this bug: - destroy the import when the export is freed, not when it's disconnected (which might be due to recovery, and might be racing with ASTs to access the same import data). (Robert's patch plus a comment fix and an EXPORT_SYMBOL.) - take a reference in ptlrpc_fail_export, because obd_disconnect always nets us -2 (all other callers have another reference, either from a request or a local-connect artifact), and we only "own" one -- the one in the hash table, which represents the network connection. Also: macroize class_export_put and class_export_get for a major simplification of export-refcount debugging. --- lustre/ldlm/ldlm_lib.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 8520ece..4f9f5fb 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -352,8 +352,6 @@ out: int target_handle_disconnect(struct ptlrpc_request *req) { - struct obd_export *export; - struct obd_import *dlmimp; int rc; ENTRY; @@ -361,19 +359,19 @@ int target_handle_disconnect(struct ptlrpc_request *req) if (rc) RETURN(rc); - /* Create an export reference to disconnect, so the rq_export - * ref is not destroyed. See class_disconnect() for more info. */ - export = class_export_get(req->rq_export); - req->rq_status = obd_disconnect(export, 0); - - dlmimp = req->rq_export->exp_ldlm_data.led_import; - class_destroy_import(dlmimp); - - class_export_put(req->rq_export); + req->rq_status = obd_disconnect(req->rq_export, 0); req->rq_export = NULL; RETURN(0); } +void target_destroy_export(struct obd_export *exp) +{ + /* exports created from last_rcvd data, and "fake" + exports created by lctl don't have an import */ + if (exp->exp_ldlm_data.led_import != NULL) + class_destroy_import(exp->exp_ldlm_data.led_import); +} + /* * Recovery functions */ -- 1.8.3.1