@@ -557,6 +557,11 @@ xfs_dinode_verify(
flags2 = be64_to_cpu(dip->di_flags2);
+ /* don't allow the metadata iflag if we don't have metadir */
+ if ((flags2 & XFS_DIFLAG2_METADATA) &&
+ !xfs_sb_version_hasmetadir(&mp->m_sb))
+ return __this_address;
+
/* don't allow reflink/cowextsize if we don't have reflink */
if ((flags2 & (XFS_DIFLAG2_REFLINK | XFS_DIFLAG2_COWEXTSIZE)) &&
!xfs_sb_version_hasreflink(&mp->m_sb))
@@ -722,7 +722,8 @@ xchk_get_inode(
error, __return_address);
return error;
}
- if (VFS_I(ip)->i_generation != sc->sm->sm_gen) {
+ if (VFS_I(ip)->i_generation != sc->sm->sm_gen ||
+ xfs_is_metadata_inode(ip)) {
xfs_irele(ip);
return -ENOENT;
}
@@ -168,6 +168,9 @@ xrep_dinode_flags(
flags2 &= ~XFS_DIFLAG2_REFLINK;
if (flags2 & XFS_DIFLAG2_REFLINK)
flags2 &= ~XFS_DIFLAG2_DAX;
+ if (!xfs_sb_version_hasmetadir(&mp->m_sb) &&
+ (flags2 & XFS_DIFLAG2_METADATA))
+ flags2 &= ~XFS_DIFLAG2_METADATA;
dip->di_flags = cpu_to_be16(flags);
dip->di_flags2 = cpu_to_be64(flags2);
}
@@ -184,6 +184,7 @@ xchk_teardown(
if (sc->ilock_flags)
xfs_iunlock(sc->ip, sc->ilock_flags);
if (sc->ip != ip_in &&
+ !xfs_is_metadata_inode(sc->ip) &&
!xfs_internal_inum(sc->mp, sc->ip->i_ino))
xfs_irele(sc->ip);
sc->ip = NULL;
@@ -927,7 +927,9 @@ xfs_imeta_iget(
if (error)
return error;
- if (ftype == XFS_DIR3_FT_UNKNOWN ||
+ if ((xfs_sb_version_hasmetadir(&mp->m_sb) &&
+ !xfs_is_metadata_inode(ip)) ||
+ ftype == XFS_DIR3_FT_UNKNOWN ||
xfs_mode_to_ftype(VFS_I(ip)->i_mode) != ftype) {
xfs_irele(ip);
return -EFSCORRUPTED;
@@ -609,8 +609,13 @@ xfs_lookup(
if (error)
goto out_free_name;
+ if (xfs_is_metadata_inode(*ipp))
+ goto out_irele;
+
return 0;
+out_irele:
+ xfs_irele(*ipp);
out_free_name:
if (ci_name)
kmem_free(ci_name->name);
@@ -2658,6 +2663,9 @@ void
xfs_imeta_irele(
struct xfs_inode *ip)
{
+ ASSERT(!xfs_sb_version_hasmetadir(&ip->i_mount->m_sb) ||
+ xfs_is_metadata_inode(ip));
+
xfs_irele(ip);
}
@@ -54,6 +54,12 @@ xfs_bulkstat_one_int(
if (error)
goto out_free;
+ if (xfs_is_metadata_inode(ip)) {
+ xfs_iunlock(ip, XFS_ILOCK_SHARED);
+ xfs_irele(ip);
+ goto out_free;
+ }
+
ASSERT(ip != NULL);
ASSERT(ip->i_imap.im_blkno != 0);
inode = VFS_I(ip);