Commit d4a34e16 authored by Eric Sandeen's avatar Eric Sandeen Committed by Darrick J. Wong

xfs: properly handle free inodes in extent hint validators

When inodes are freed in xfs_ifree(), di_flags is cleared (so extent size
hints are removed) but the actual extent size fields are left intact.
This causes the extent hint validators to fail on freed inodes which once
had extent size hints.

This can be observed (for example) by running xfs/229 twice on a
non-crc xfs filesystem, or presumably on V5 with ikeep.

Fixes: 7d71a671 ("xfs: verify extent size hint is valid in inode verifier")
Fixes: 02a0fda8 ("xfs: verify COW extent size hint is valid in inode verifier")
Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 9991274f
...@@ -731,7 +731,8 @@ xfs_inode_validate_extsize( ...@@ -731,7 +731,8 @@ xfs_inode_validate_extsize(
if ((hint_flag || inherit_flag) && extsize == 0) if ((hint_flag || inherit_flag) && extsize == 0)
return __this_address; return __this_address;
if (!(hint_flag || inherit_flag) && extsize != 0) /* free inodes get flags set to zero but extsize remains */
if (mode && !(hint_flag || inherit_flag) && extsize != 0)
return __this_address; return __this_address;
if (extsize_bytes % blocksize_bytes) if (extsize_bytes % blocksize_bytes)
...@@ -777,7 +778,8 @@ xfs_inode_validate_cowextsize( ...@@ -777,7 +778,8 @@ xfs_inode_validate_cowextsize(
if (hint_flag && cowextsize == 0) if (hint_flag && cowextsize == 0)
return __this_address; return __this_address;
if (!hint_flag && cowextsize != 0) /* free inodes get flags set to zero but cowextsize remains */
if (mode && !hint_flag && cowextsize != 0)
return __this_address; return __this_address;
if (hint_flag && rt_flag) if (hint_flag && rt_flag)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment