From: Fan Yong Date: Thu, 23 Jul 2015 21:37:30 +0000 (+0800) Subject: LU-6895 osd-ldiskfs: handle REMOTE_PARENT_DIR properly X-Git-Tag: 2.7.60~28 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=6bf1d78ed87dc25cef0e8a48f1ef251f9bb017a8 LU-6895 osd-ldiskfs: handle REMOTE_PARENT_DIR properly For a remote directory D_n, its name entry resides on the MDT_x, its object resides on the MDT_y. On the MDT_y, the D_n's object is inserted under REMOTE_PARENT_DIR and its dotdot entry is set as the REMOTE_PARENT_DIR to satisfy local e2fsck. When the namespace LFSCK scans the D_n directory on the MDT_y, the REMOTE_PARENT_DIR will be found with LMAC_NOT_IN_OI in LMA, the osd_dirent_check_repair() should NOT assert for such case. Signed-off-by: Fan Yong Change-Id: Id7fc10caae81be7d751c338fda401a6be93562ef Reviewed-on: http://review.whamcloud.com/16035 Reviewed-by: Andreas Dilger Reviewed-by: wangdi Tested-by: Jenkins Tested-by: Maloo --- diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 09709b3..ee45354 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -5182,7 +5182,29 @@ again: rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma); if (rc == 0) { - LASSERT(!(lma->lma_compat & LMAC_NOT_IN_OI)); + if (unlikely(lma->lma_compat & LMAC_NOT_IN_OI)) { + struct lu_fid *tfid = &lma->lma_self_fid; + + *attr |= LUDA_IGNORE; + + /* It must be REMOTE_PARENT_DIR and as the + * dotdot entry of remote directory */ + if (unlikely(dot_dotdot != 2 || + fid_seq(tfid) != FID_SEQ_LOCAL_FILE || + fid_oid(tfid) != REMOTE_PARENT_DIR_OID)) { + CDEBUG(D_LFSCK, "%.16s: expect remote agent " + "parent directory, but got %.*s under " + "dir = %lu/%u with the FID "DFID"\n", + devname, ent->oied_namelen, + ent->oied_name, dir->i_ino, + dir->i_generation, PFID(tfid)); + + rc = -EIO; + } + + + GOTO(out_inode, rc); + } if (fid_is_sane(fid)) { /* FID-in-dirent is valid. */