Whamcloud - gitweb
LU-4525 lfsck: distinguish objects visibility by LFSCK 86/9186/4
authorFan Yong <fan.yong@intel.com>
Fri, 31 Jan 2014 03:55:59 +0000 (11:55 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 13 Feb 2014 19:13:53 +0000 (19:13 +0000)
Originally, the ldiskfs backend otable-based iteration only returned
namespace visible FIDs. That means that the OSD needs to distinguish
related objects visibility. But the OSD should not has the knowledge
about the objects visibility. It is the iteration caller - LFSCK, to
distinguish that by itself.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I1eef4041170e856af00a4b222d053ccb3d8d0023
Reviewed-on: http://review.whamcloud.com/9186
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lfsck/lfsck_engine.c
lustre/osd-ldiskfs/osd_compat.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_internal.h
lustre/osd-ldiskfs/osd_oi.c
lustre/osd-ldiskfs/osd_scrub.c

index be9b008..6f0ec24 100644 (file)
@@ -306,6 +306,12 @@ static int lfsck_master_oit_engine(const struct lu_env *env,
                                ostid_to_fid(fid, oi, idx);
                                update_lma = true;
                        }
+               } else if (!fid_is_norm(fid) && !fid_is_igif(fid) &&
+                          !fid_is_last_id(fid) && !fid_is_root(fid) &&
+                          !fid_seq_is_dot(fid_seq(fid))) {
+                       /* If the FID/object is only used locally and invisible
+                        * to external nodes, then LFSCK will not handle it. */
+                       goto checkpoint;
                }
 
                target = lfsck_object_find(env, lfsck, fid);
index 6ec1129..e693e8d 100644 (file)
@@ -183,7 +183,6 @@ static int osd_mdt_init(const struct lu_env *env, struct osd_device *dev)
        if (IS_ERR(d))
                GOTO(cleanup, rc = PTR_ERR(d));
 
-       ldiskfs_set_inode_state(d->d_inode, LDISKFS_STATE_LUSTRE_NO_OI);
        omm->omm_remote_parent = d;
 
        /* Set LMA for remote parent inode */
@@ -399,7 +398,6 @@ static int osd_ost_init(const struct lu_env *env, struct osd_device *dev)
        }
 
        inode = d->d_inode;
-       ldiskfs_set_inode_state(inode, LDISKFS_STATE_LUSTRE_NO_OI);
        dev->od_ost_map->om_root = d;
 
        /* 'What the @fid is' is not imporatant, because the object
@@ -741,7 +739,6 @@ static int osd_seq_load_locked(struct osd_thread_info *info,
                GOTO(out_put, rc = -EFAULT);
 
        inode = seq_dir->d_inode;
-       ldiskfs_set_inode_state(inode, LDISKFS_STATE_LUSTRE_NO_OI);
        osd_seq->oos_root = seq_dir;
 
        /* 'What the @fid is' is not imporatant, because the object
@@ -772,7 +769,6 @@ static int osd_seq_load_locked(struct osd_thread_info *info,
                }
 
                inode = dir->d_inode;
-               ldiskfs_set_inode_state(inode, LDISKFS_STATE_LUSTRE_NO_OI);
                osd_seq->oos_dirs[i] = dir;
 
                /* 'What the @fid is' is not imporatant, because the object
index 6f369d0..2b7c822 100644 (file)
@@ -2031,7 +2031,6 @@ static int osd_mkfile(struct osd_thread_info *info, struct osd_object *obj,
                /* For new created object, it must be consistent,
                 * and it is unnecessary to scrub against it. */
                ldiskfs_set_inode_state(inode, LDISKFS_STATE_LUSTRE_NOSCRUB);
-               ldiskfs_clear_inode_state(inode, LDISKFS_STATE_LUSTRE_NO_OI);
                 obj->oo_inode = inode;
                 result = 0;
         } else {
@@ -2639,7 +2638,6 @@ static struct inode *osd_create_local_agent_inode(const struct lu_env *env,
                RETURN(local);
        }
 
-       ldiskfs_set_inode_state(local, LDISKFS_STATE_LUSTRE_NO_OI);
        /* Set special LMA flag for local agent inode */
        rc = osd_ea_fid_set(info, local, fid, 0, LMAI_AGENT);
        if (rc != 0) {
@@ -5622,7 +5620,6 @@ static int osd_mount(const struct lu_env *env,
                LDISKFS_SB(osd_sb(o))->s_mount_opt |= LDISKFS_MOUNT_DIRDATA;
 #endif
        inode = osd_sb(o)->s_root->d_inode;
-       ldiskfs_set_inode_state(inode, LDISKFS_STATE_LUSTRE_NO_OI);
        lu_local_obj_fid(fid, OSD_FS_ROOT_OID);
        rc = osd_ea_fid_set(info, inode, fid, LMAC_NOT_IN_OI, 0);
        if (rc != 0) {
index 8436d1f..6c84842 100644 (file)
@@ -78,9 +78,6 @@ struct inode;
 /* OI scrub should skip this inode. */
 #define LDISKFS_STATE_LUSTRE_NOSCRUB   31
 
-/* Do not add OI mapping for this inode. */
-#define LDISKFS_STATE_LUSTRE_NO_OI     30
-
 /** Enable thandle usage statistics */
 #define OSD_THANDLE_STATS (0)
 
index b4bfb9a..3cb6579 100644 (file)
@@ -228,7 +228,6 @@ static int osd_oi_open(struct osd_thread_info *info, struct osd_device *osd,
         if (IS_ERR(inode))
                 RETURN(PTR_ERR(inode));
 
-       ldiskfs_set_inode_state(inode, LDISKFS_STATE_LUSTRE_NO_OI);
        /* 'What the @fid is' is not imporatant, because these objects
         * have no OI mappings, and only are visible inside the OSD.*/
        lu_igif_build(&info->oti_fid, inode->i_ino, inode->i_generation);
index cce33af..9a5572f 100644 (file)
@@ -808,56 +808,31 @@ static int osd_scrub_get_fid(struct osd_thread_info *info,
        rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
        if (rc == 0) {
                has_lma = true;
-               if (lma->lma_compat & LMAC_NOT_IN_OI) {
-                       ldiskfs_set_inode_state(inode,
-                                               LDISKFS_STATE_LUSTRE_NO_OI);
+               if (lma->lma_compat & LMAC_NOT_IN_OI ||
+                   lma->lma_incompat & LMAI_AGENT)
                        return SCRUB_NEXT_CONTINUE;
-               }
 
                *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;
-                       return rc;
-               }
-
                if (!scrub)
                        return 0;
 
-               if (fid_is_namespace_visible(fid) && !fid_is_norm(fid))
-                       return 0;
-
                if (lma->lma_compat & LMAC_FID_ON_OST)
                        return SCRUB_NEXT_OSTOBJ;
 
                if (fid_is_idif(fid))
                        return SCRUB_NEXT_OSTOBJ_OLD;
 
-               if (lma->lma_incompat & LMAI_AGENT)
-                       return SCRUB_NEXT_CONTINUE;
+               /* For local object. */
+               if (fid_is_internal(fid))
+                       return 0;
 
-               /* Here, it may be MDT-object, or may be 2.4 OST-object.
-                * Fall through. */
+               /* For external visible MDT-object with non-normal FID. */
+               if (fid_is_namespace_visible(fid) && !fid_is_norm(fid))
+                       return 0;
+
+               /* For the object with normal FID, it may be MDT-object,
+                * or may be 2.4 OST-object, need further distinguish.
+                * Fall through to next section. */
        }
 
        if (rc == -ENODATA || rc == 0) {
@@ -931,11 +906,6 @@ static int osd_iit_iget(struct osd_thread_info *info, struct osd_device *dev,
                RETURN(rc);
        }
 
-       /* If the inode has no OI mapping, then it is special locally used,
-        * should be invisible to OI scrub or up layer LFSCK. */
-       if (ldiskfs_test_inode_state(inode, LDISKFS_STATE_LUSTRE_NO_OI))
-               GOTO(put, rc = SCRUB_NEXT_CONTINUE);
-
        if (scrub &&
            ldiskfs_test_inode_state(inode, LDISKFS_STATE_LUSTRE_NOSCRUB)) {
                /* Only skip it for the first OI scrub accessing. */
@@ -2119,7 +2089,6 @@ int osd_scrub_setup(const struct lu_env *env, struct osd_device *dev)
        }
 
        inode = filp->f_dentry->d_inode;
-       ldiskfs_set_inode_state(inode, LDISKFS_STATE_LUSTRE_NO_OI);
        /* 'What the @fid is' is not imporatant, because the object
         * has no OI mapping, and only is visible inside the OSD.*/
        lu_igif_build(fid, inode->i_ino, inode->i_generation);