Commit 6e33017c authored by Darrick J. Wong's avatar Darrick J. Wong Committed by Carlos Maiolino
Browse files

xfs: fix data fork format filtering during inode repair



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: default avatar"Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarCarlos Maiolino <cem@kernel.org>
parent 66314e9a
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -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;
		case XFS_DINODE_FMT_EXTENTS:
		case XFS_DINODE_FMT_BTREE:
		case XFS_DINODE_FMT_META_BTREE:
			break;
		default:
			return true;
		fallthrough;
		}
		break;
	case S_IFLNK:
	case S_IFDIR:
		switch (fmt) {