Whamcloud - gitweb
LU-1267 lfsck: rebuild LAST_ID
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_scrub.c
index 303d769..cce33af 100644 (file)
@@ -815,6 +815,26 @@ static int osd_scrub_get_fid(struct osd_thread_info *info,
                }
 
                *fid = lma->lma_self_fid;
+               if (unlikely(fid_is_last_id(fid))) {
+                       if (scrub) {
+                               if (lma->lma_compat & LMAC_FID_ON_OST)
+                                       rc = SCRUB_NEXT_OSTOBJ;
+                               else
+                                       rc = osd_scrub_check_local_fldb(info,
+                                                               dev, fid);
+                       }
+
+                       /* XXX: For up layer iteration, LAST_ID is a visible
+                        *      object to be checked and repaired, so return
+                        *      it directly.
+                        *
+                        *      In fact, the OSD layer otable-based iteration
+                        *      should not care about the FID type, it is the
+                        *      up layer user's duty (LFSCK) to handle that.
+                        *      It will be fixed in other patch in future. */
+                       return rc;
+               }
+
                if (fid_is_internal(&lma->lma_self_fid)) {
                        if (!scrub)
                                rc = SCRUB_NEXT_CONTINUE;
@@ -830,7 +850,7 @@ static int osd_scrub_get_fid(struct osd_thread_info *info,
                if (lma->lma_compat & LMAC_FID_ON_OST)
                        return SCRUB_NEXT_OSTOBJ;
 
-               if (fid_is_idif(fid) || fid_is_last_id(fid))
+               if (fid_is_idif(fid))
                        return SCRUB_NEXT_OSTOBJ_OLD;
 
                if (lma->lma_incompat & LMAI_AGENT)