diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c
index 2bb75145e5b8c3242d4b443e0d7cdfe66e10a263..9e4a7f572467c6c65da6418175d4e98baf27f4d8 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 5d002c899dde067bee81c18a41dc7211128a4e5b..cb060396c785c55e2eed303644e43d71029d5f1f 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);
 }