From bd39d130f8d430524bcfded06bbc2f19769b50f8 Mon Sep 17 00:00:00 2001
From: wangdi <wangdi>
Date: Fri, 4 Jul 2008 16:20:31 +0000
Subject: [PATCH] Branch HEAD check import before put it. b=15684 i=adilger

---
 lustre/obdclass/genops.c     | 2 +-
 lustre/ptlrpc/recov_thread.c | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c
index 2bb75145e5..9e4a7f5724 100644
--- a/lustre/obdclass/genops.c
+++ b/lustre/obdclass/genops.c
@@ -808,6 +808,7 @@ void class_import_put(struct obd_import *import)
 
         EXIT;
 }
+EXPORT_SYMBOL(class_import_put);
 
 void class_import_destroy(struct obd_import *import)
 {
@@ -835,7 +836,6 @@ void class_import_destroy(struct obd_import *import)
         OBD_FREE_RCU(import, sizeof(*import), &import->imp_handle);
         EXIT;
 }
-EXPORT_SYMBOL(class_import_put);
 
 struct obd_import *class_new_import(struct obd_device *obd)
 {
diff --git a/lustre/ptlrpc/recov_thread.c b/lustre/ptlrpc/recov_thread.c
index 5d002c899d..cb060396c7 100644
--- a/lustre/ptlrpc/recov_thread.c
+++ b/lustre/ptlrpc/recov_thread.c
@@ -167,8 +167,10 @@ static void ctxt_llcd_put(struct llog_ctxt *ctxt)
                 llcd_put(ctxt->loc_llcd);
                 ctxt->loc_llcd = NULL;
         }
-        class_import_put(ctxt->loc_imp);
-        ctxt->loc_imp = NULL;
+        if (ctxt->loc_imp) {
+                class_import_put(ctxt->loc_imp);
+                ctxt->loc_imp = NULL;
+        }
         mutex_up(&ctxt->loc_sem);
 }
 
-- 
GitLab