Skip to content

Commit

Permalink
xfs: fix data fork format filtering during inode repair
Browse files Browse the repository at this point in the history
Coverity noticed that xrep_dinode_bad_metabt_fork never runs because
XFS_DINODE_FMT_META_BTREE is always filtered out in the mode selection
switch of xrep_dinode_check_dfork.

Metadata btrees are allowed only in the data forks of regular files, so
add this case explicitly.  I guess this got fubard during a refactoring
prior to 6.13 and I didn't notice until now. :/

Coverity-id: 1617714
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
  • Loading branch information
Darrick J. Wong authored and Carlos Maiolino committed Feb 14, 2025
1 parent 66314e9 commit 6e33017
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions fs/xfs/scrub/inode_repair.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,9 +1055,17 @@ xrep_dinode_check_dfork(
return true;
break;
case S_IFREG:
if (fmt == XFS_DINODE_FMT_LOCAL)
switch (fmt) {
case XFS_DINODE_FMT_LOCAL:
return true;
fallthrough;
case XFS_DINODE_FMT_EXTENTS:
case XFS_DINODE_FMT_BTREE:
case XFS_DINODE_FMT_META_BTREE:
break;
default:
return true;
}
break;
case S_IFLNK:
case S_IFDIR:
switch (fmt) {
Expand Down

0 comments on commit 6e33017

Please sign in to comment.