Whamcloud - gitweb
LU-8472 scrub: try to avoid recovery during OI scrub
[fs/lustre-release.git] / lustre / target / update_recovery.c
index 7cece02..85764cf 100644 (file)
@@ -20,7 +20,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2014, Intel Corporation.
+ * Copyright (c) 2014, 2015, Intel Corporation.
  */
 
 /*
 #define DEBUG_SUBSYSTEM S_CLASS
 
 #include <lu_target.h>
-#include <md_object.h>
+#include <lustre_obdo.h>
 #include <lustre_update.h>
+#include <lustre_swab.h>
+#include <md_object.h>
 #include <obd.h>
 #include <obd_class.h>
+
 #include "tgt_internal.h"
 
 /**
@@ -442,7 +445,7 @@ again:
         * we do not need lock here */
        if (replace_record) {
                /* Replace the update record and master transno */
-               OBD_FREE(dtrq->dtrq_lur, dtrq->dtrq_lur_size);
+               OBD_FREE_LARGE(dtrq->dtrq_lur, dtrq->dtrq_lur_size);
                dtrq->dtrq_lur = NULL;
                dtrq->dtrq_lur_size = llog_update_record_size(lur);
                OBD_ALLOC_LARGE(dtrq->dtrq_lur, dtrq->dtrq_lur_size);
@@ -1164,6 +1167,17 @@ static int update_recovery_exec(const struct lu_env *env,
                dt_obj = dt_locate(env, tdtd->tdtd_dt, fid);
                if (IS_ERR(dt_obj)) {
                        rc = PTR_ERR(dt_obj);
+                       if (rc == -EREMCHG)
+                               LCONSOLE_WARN("%.16s: hit invalid OI mapping "
+                                             "for "DFID" during recovering, "
+                                             "that may because auto scrub is "
+                                             "disabled on related MDT, and "
+                                             "will cause recovery failure. "
+                                             "Please enable auto scrub and "
+                                             "retry the recovery.\n",
+                                             tdtd->tdtd_lut->lut_obd->obd_name,
+                                             PFID(fid));
+
                        break;
                }
                sub_dt_obj = dt_object_child(dt_obj);