From 2c03f6d1e4431f1869a57557e928dfc3f9331521 Mon Sep 17 00:00:00 2001
From: rread <rread>
Date: Wed, 18 Feb 2004 21:37:24 +0000
Subject: [PATCH] b=2751

Don't do precreate orphan recovery on an OST if the MDS is in recovery
mode. The OSC's last_id info is not initialized until after MDS
recovery is complete, so clearing the orphans here would result in
removing all the objects on the OST.
---
 lustre/mds/mds_lov.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c
index d272b33880..9cd8bbc0a2 100644
--- a/lustre/mds/mds_lov.c
+++ b/lustre/mds/mds_lov.c
@@ -497,6 +497,7 @@ int mds_notify(struct obd_device *obd, struct obd_device *watched,
                int active)
 {
         struct obd_uuid *uuid; 
+        int rc = 0;
 
         if (!active)
                 RETURN(0);
@@ -508,10 +509,16 @@ int mds_notify(struct obd_device *obd, struct obd_device *watched,
                 RETURN(-EINVAL);
         }
 
-        uuid = &watched->u.cli.cl_import->imp_target_uuid;
-        CWARN("MDS %s: %s now active, resetting orphans\n",
-               obd->obd_name, uuid->uuid);
-        RETURN(mds_lov_clearorphans(&obd->u.mds, uuid));
+        if (obd->obd_recovering) {
+                CWARN("MDS %s: in recovery, not resetting orphans on %s\n",
+                      obd->obd_name, uuid->uuid);
+        } else {
+                uuid = &watched->u.cli.cl_import->imp_target_uuid;
+                CWARN("MDS %s: %s now active, resetting orphans\n",
+                      obd->obd_name, uuid->uuid);
+                rc = mds_lov_clearorphans(&obd->u.mds, uuid);
+        }
+        RETURN(rc);
 }
 
 /* Convert the on-disk LOV EA structre.
-- 
GitLab