Skip to content

Commit b102a46

Browse files
author
Darrick J. Wong
committed
xfs: detect misaligned rtinherit directory extent size hints
If we encounter a directory that has been configured to pass on an extent size hint to a new realtime file and the hint isn't an integer multiple of the rt extent size, we should flag the hint for administrative review because that is a misconfiguration (that other parts of the kernel will fix automatically). Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent 0925fec commit b102a46

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

fs/xfs/scrub/inode.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,25 @@ xchk_inode_extsize(
7373
uint16_t flags)
7474
{
7575
xfs_failaddr_t fa;
76+
uint32_t value = be32_to_cpu(dip->di_extsize);
7677

77-
fa = xfs_inode_validate_extsize(sc->mp, be32_to_cpu(dip->di_extsize),
78-
mode, flags);
78+
fa = xfs_inode_validate_extsize(sc->mp, value, mode, flags);
7979
if (fa)
8080
xchk_ino_set_corrupt(sc, ino);
81+
82+
/*
83+
* XFS allows a sysadmin to change the rt extent size when adding a rt
84+
* section to a filesystem after formatting. If there are any
85+
* directories with extszinherit and rtinherit set, the hint could
86+
* become misaligned with the new rextsize. The verifier doesn't check
87+
* this, because we allow rtinherit directories even without an rt
88+
* device. Flag this as an administrative warning since we will clean
89+
* this up eventually.
90+
*/
91+
if ((flags & XFS_DIFLAG_RTINHERIT) &&
92+
(flags & XFS_DIFLAG_EXTSZINHERIT) &&
93+
value % sc->mp->m_sb.sb_rextsize > 0)
94+
xchk_ino_set_warning(sc, ino);
8195
}
8296

8397
/*

0 commit comments

Comments
 (0)