From af46e574eeebe23c5a6146a134fa00ee91931de3 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Fri, 18 Sep 2015 00:40:03 +0800 Subject: [PATCH 1/1] LU-7268 scrub: NOT assign LMA for EA inode Originally, when OI scrub scans the device, if the target inode has no FID-in-LMA EA, then it will generate an IGIF mode FID and store it in the LMA EA. Such behavior is not suitable if the target inode is used for large EA. The OI scrub should skip the EA inode that is marked as "LDISKFS_EA_INODE_FL". Signed-off-by: Fan Yong Change-Id: I52b05b864ef8a2797a2f3dda0f80f95227809c34 Reviewed-on: http://review.whamcloud.com/17043 Tested-by: Jenkins Reviewed-by: Kalpak Shah Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/osd-ldiskfs/osd_compat.c | 7 +++++++ lustre/osd-ldiskfs/osd_internal.h | 5 +++++ lustre/osd-ldiskfs/osd_oi.c | 7 +++++++ lustre/osd-ldiskfs/osd_scrub.c | 12 ++++++++++++ 4 files changed, 31 insertions(+) diff --git a/lustre/osd-ldiskfs/osd_compat.c b/lustre/osd-ldiskfs/osd_compat.c index 637b1bd..0779f25 100644 --- a/lustre/osd-ldiskfs/osd_compat.c +++ b/lustre/osd-ldiskfs/osd_compat.c @@ -563,6 +563,13 @@ static int osd_obj_update_entry(struct osd_thread_info *info, GOTO(out, rc); } + /* The EA inode should NOT be in OI, old OI scrub may added + * such OI mapping by wrong, replace it. */ + if (unlikely(osd_is_ea_inode(inode))) { + iput(inode); + goto update; + } + rc = osd_get_lma(info, inode, dentry, lma); if (rc == -ENODATA) { rc = osd_get_idif(info, inode, dentry, oi_fid); diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index 7ad0c24..b47f653 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -913,6 +913,11 @@ static inline char *osd_name(struct osd_device *osd) return osd->od_dt_dev.dd_lu_dev.ld_obd->obd_name; } +static inline bool osd_is_ea_inode(struct inode *inode) +{ + return !!(LDISKFS_I(inode)->i_flags & LDISKFS_EA_INODE_FL); +} + extern const struct dt_body_operations osd_body_ops; extern struct lu_context_key osd_key; diff --git a/lustre/osd-ldiskfs/osd_oi.c b/lustre/osd-ldiskfs/osd_oi.c index c377368..6f15760 100644 --- a/lustre/osd-ldiskfs/osd_oi.c +++ b/lustre/osd-ldiskfs/osd_oi.c @@ -658,6 +658,13 @@ int osd_oi_insert(struct osd_thread_info *info, struct osd_device *osd, return rc; } + /* The EA inode should NOT be in OI, old OI scrub may added + * such OI mapping by wrong, replace it. */ + if (unlikely(osd_is_ea_inode(inode))) { + iput(inode); + goto update; + } + rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma); iput(inode); if (rc == -ENODATA) diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index 31b879b..ff639e2 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -497,6 +497,10 @@ osd_scrub_check_update(struct osd_thread_info *info, struct osd_device *dev, GOTO(out, rc); } + /* The inode has been reused as EA inode, ignore it. */ + if (unlikely(osd_is_ea_inode(inode))) + GOTO(out, rc = 0); + sf->sf_flags |= SF_UPGRADE; sf->sf_internal_flags &= ~SIF_NO_HANDLE_OLD_FID; dev->od_check_ff = 1; @@ -536,6 +540,10 @@ iget: rc = 0; GOTO(out, rc); } + + /* The inode has been reused as EA inode, ignore it. */ + if (unlikely(osd_is_ea_inode(inode))) + GOTO(out, rc = 0); } if (!scrub->os_partial_scan) @@ -958,6 +966,10 @@ static int osd_iit_iget(struct osd_thread_info *info, struct osd_device *dev, RETURN(rc); } + /* It is an EA inode, no OI mapping for it, skip it. */ + if (osd_is_ea_inode(inode)) + 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. */ -- 1.8.3.1