Whamcloud - gitweb
LU-2237 osd: skip OI ops for local objects
authorFan Yong <yong.fan@whamcloud.com>
Sat, 27 Oct 2012 07:45:27 +0000 (00:45 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 30 Oct 2012 23:01:00 +0000 (19:01 -0400)
We should not add the FID mapping in the OI file for local object.
Otherwise it will cause OI lookup to return non-exist local object
when the local object lost for system crash, and it also prevents
new local object to be created, and then causes the server cannot
mountup.

This issue has been fixed in OI scrub project, which will be back
ported to lustre-2.1 soon. This is a temporary patch to allow the
current lustre-2.1 to be workable.

Signed-off-by: Fan Yong <yong.fan@whamcloud.com>
Change-Id: Ibe2861818aaef3842605fb7d4e24cc02dad22104
Reviewed-on: http://review.whamcloud.com/4395
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
lustre/osd-ldiskfs/osd_oi.c

index c63b7f5..ea1d8b4 100644 (file)
@@ -185,21 +185,15 @@ void osd_oi_fini(struct osd_thread_info *info, struct osd_oi *oi)
         }
 }
 
-static inline int fid_is_oi_fid(const struct lu_fid *fid)
-{
-        /* We need to filter-out oi obj's fid. As we can not store it, while
-         * oi-index create operation.
-         */
-        return (unlikely(fid_seq(fid) == FID_SEQ_LOCAL_FILE &&
-                fid_oid(fid) == OSD_OI_FID_16_OID));
-}
-
 int osd_oi_lookup(struct osd_thread_info *info, struct osd_oi *oi,
                   const struct lu_fid *fid, struct osd_inode_id *id)
 {
         struct lu_fid *oi_fid = &info->oti_fid;
         int rc;
 
+       if (fid_seq(fid) == FID_SEQ_LOCAL_FILE)
+               return -ENOENT;
+
         if (osd_fid_is_igif(fid)) {
                 lu_igif_to_id(fid, id);
                 rc = 0;
@@ -207,9 +201,6 @@ int osd_oi_lookup(struct osd_thread_info *info, struct osd_oi *oi,
                 struct dt_object    *idx;
                 const struct dt_key *key;
 
-                if (fid_is_oi_fid(fid))
-                        return -ENOENT;
-
                 idx = oi->oi_dir;
                 fid_cpu_to_be(oi_fid, fid);
                 key = (struct dt_key *) oi_fid;
@@ -235,10 +226,10 @@ int osd_oi_insert(struct osd_thread_info *info, struct osd_oi *oi,
         struct osd_inode_id *id;
         const struct dt_key *key;
 
-        if (osd_fid_is_igif(fid))
-                return 0;
+       if (fid_seq(fid) == FID_SEQ_LOCAL_FILE)
+               return 0;
 
-        if (fid_is_oi_fid(fid))
+        if (osd_fid_is_igif(fid))
                 return 0;
 
         idx = oi->oi_dir;