Whamcloud - gitweb
LU-3314 scrub: use special fixed FID for .lustre
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_scrub.c
index 71c183f..bf6a8b9 100644 (file)
@@ -1137,7 +1137,7 @@ static const struct osd_lf_map osd_lf_maps[] = {
                osd_ios_general_scan, osd_ios_varfid_fill },
 
        /* PENDING */
-       { "PENDING", { FID_SEQ_LOCAL_FILE, MDD_ORPHAN_OID, 0 }, 0, NULL, NULL },
+       { "PENDING", { 0, 0, 0 }, 0, NULL, NULL },
 
        /* ROOT */
        { "ROOT", { FID_SEQ_ROOT, 1, 0 },
@@ -1158,8 +1158,7 @@ static const struct osd_lf_map osd_lf_maps[] = {
                NULL, NULL },
 
        /* lfsck_bookmark */
-       { "lfsck_bookmark", { FID_SEQ_LOCAL_FILE, LFSCK_BOOKMARK_OID, 0 }, 0,
-               NULL, NULL },
+       { "lfsck_bookmark", { 0, 0, 0 }, 0, NULL, NULL },
 
        /* lov_objid */
        { LOV_OBJID, { FID_SEQ_LOCAL_FILE, MDD_LOV_OBJ_OID, 0 }, OLF_SHOW_NAME,
@@ -1177,18 +1176,6 @@ static const struct osd_lf_map osd_lf_maps[] = {
        { QSD_DIR, { 0, 0, 0 }, OLF_SCAN_SUBITEMS,
                osd_ios_general_scan, osd_ios_varfid_fill },
 
-       /* seq-1-lastid */
-       { "seq-1-lastid", { FID_SEQ_LLOG, 1, 0 }, 0,
-               NULL, NULL },
-
-       /* seq-a-lastid */
-       { "seq-a-lastid", { FID_SEQ_LLOG_NAME, 1, 0 }, 0,
-               NULL, NULL },
-
-       /* seq-200000003-lastid */
-       { "seq-200000003-lastid", { FID_SEQ_LOCAL_NAME, 1, 0 }, 0,
-               NULL, NULL },
-
        /* seq_ctl */
        { "seq_ctl", { FID_SEQ_LOCAL_FILE, FID_SEQ_CTL_OID, 0 },
                OLF_SHOW_NAME, NULL, NULL },
@@ -1197,17 +1184,12 @@ static const struct osd_lf_map osd_lf_maps[] = {
        { "seq_srv", { FID_SEQ_LOCAL_FILE, FID_SEQ_SRV_OID, 0 },
                OLF_SHOW_NAME, NULL, NULL },
 
-       /* LAST_GROUP */
-       { "LAST_GROUP", { FID_SEQ_LOCAL_FILE, OFD_LAST_GROUP_OID, 0 },
-               OLF_SHOW_NAME, NULL, NULL },
-
        /* health_check */
        { HEALTH_CHECK, { FID_SEQ_LOCAL_FILE, OFD_HEALTH_CHECK_OID, 0 },
                OLF_SHOW_NAME, NULL, NULL },
 
        /* lfsck_namespace */
-       { "lfsck_namespace", { FID_SEQ_LOCAL_FILE, LFSCK_BOOKMARK_OID, 0 }, 0,
-               NULL, NULL },
+       { "lfsck_namespace", { 0, 0, 0 }, 0, NULL, NULL },
 
        /* OBJECTS, upgrade from old device */
        { OBJECTS, { 0, 0, 0 }, OLF_SCAN_SUBITEMS, osd_ios_OBJECTS_scan, NULL },
@@ -1218,6 +1200,10 @@ static const struct osd_lf_map osd_lf_maps[] = {
        /* lquota_v2.group, upgrade from old device */
        { "lquota_v2.group", { 0, 0, 0 }, 0, NULL, NULL },
 
+       /* LAST_GROUP, upgrade from old device */
+       { "LAST_GROUP", { FID_SEQ_LOCAL_FILE, OFD_LAST_GROUP_OID, 0 },
+               OLF_SHOW_NAME, NULL, NULL },
+
        { NULL, { 0, 0, 0 }, 0, NULL, NULL }
 };
 
@@ -1476,7 +1462,31 @@ osd_ios_ROOT_scan(struct osd_thread_info *info, struct osd_device *dev,
                        }
                }
        } else {
-               rc = osd_ios_scan_one(info, dev, child->d_inode, NULL, 0);
+               /* For lustre-2.x (x <= 3), the ".lustre" has NO FID-in-LMA,
+                * so the client will get IGIF for the ".lustre" object when
+                * the MDT restart.
+                *
+                * From the OI scrub view, when the MDT upgrade to Lustre-2.4,
+                * it does not know whether there are some old clients cached
+                * the ".lustre" IGIF during the upgrading. Two choices:
+                *
+                * 1) Generate IGIF-in-LMA and IGIF-in-OI for the ".lustre".
+                *    It will allow the old connected clients to access the
+                *    ".lustre" with cached IGIF. But it will cause others
+                *    on the MDT failed to check "fid_is_dot_lustre()".
+                *
+                * 2) Use fixed FID {FID_SEQ_DOT_LUSTRE, FID_OID_DOT_LUSTRE, 0}
+                *    for ".lustre" in spite of whether there are some clients
+                *    cached the ".lustre" IGIF or not. It enables the check
+                *    "fid_is_dot_lustre()" on the MDT, although it will cause
+                *    that the old connected clients cannot access the ".lustre"
+                *    with the cached IGIF.
+                *
+                * Usually, it is rare case for the old connected clients
+                * to access the ".lustre" with cached IGIF. So we prefer
+                * to the solution 2). */
+               rc = osd_ios_scan_one(info, dev, child->d_inode,
+                                     &LU_DOT_LUSTRE_FID, 0);
                dput(child);
        }