From 3a12cd68a9929c573a981091a0fa6dd95420306f Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Sat, 27 Oct 2012 00:45:27 -0700 Subject: [PATCH] LU-2237 osd: skip OI ops for local objects 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 Change-Id: Ibe2861818aaef3842605fb7d4e24cc02dad22104 Reviewed-on: http://review.whamcloud.com/4395 Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Alex Zhuravlev --- lustre/osd-ldiskfs/osd_oi.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/lustre/osd-ldiskfs/osd_oi.c b/lustre/osd-ldiskfs/osd_oi.c index c63b7f5..ea1d8b4 100644 --- a/lustre/osd-ldiskfs/osd_oi.c +++ b/lustre/osd-ldiskfs/osd_oi.c @@ -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; -- 1.8.3.1