public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: fix data fork format filtering during inode repair
@ 2025-01-16  0:36 Darrick J. Wong
  2025-01-16  4:37 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2025-01-16  0:36 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: linux-xfs, hch

From: Darrick J. Wong <djwong@kernel.org>

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>
---
 fs/xfs/scrub/inode_repair.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/scrub/inode_repair.c b/fs/xfs/scrub/inode_repair.c
index c8d17dd4fc3246..4299063ffe8749 100644
--- a/fs/xfs/scrub/inode_repair.c
+++ b/fs/xfs/scrub/inode_repair.c
@@ -1057,9 +1057,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) {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: fix data fork format filtering during inode repair
  2025-01-16  0:36 [PATCH] xfs: fix data fork format filtering during inode repair Darrick J. Wong
@ 2025-01-16  4:37 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2025-01-16  4:37 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Carlos Maiolino, linux-xfs, hch

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-16  4:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-16  0:36 [PATCH] xfs: fix data fork format filtering during inode repair Darrick J. Wong
2025-01-16  4:37 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox