From: Christoph Hellwig Date: Sun, 4 Aug 2024 09:51:16 +0000 (+0200) Subject: xfs: return -ENOENT when trying to scrub non-existing rtgroup X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fxfs-per-rtg-bitmap-rebase;p=users%2Fhch%2Fxfs.git xfs: return -ENOENT when trying to scrub non-existing rtgroup Provide a fallback for scrub code trying to scrub RTG 0 when it doesn't actually exist for a file system with the RTGROUPS feature bit, but without any RT extents. Signed-off-by: Christoph Hellwig --- diff --git a/fs/xfs/scrub/scrub.c b/fs/xfs/scrub/scrub.c index f942141c6539..51f155c5596d 100644 --- a/fs/xfs/scrub/scrub.c +++ b/fs/xfs/scrub/scrub.c @@ -510,10 +510,16 @@ xchk_validate_inputs( case ST_RTGROUP: if (sm->sm_ino || sm->sm_gen) goto out; - if (!xfs_has_rtgroups(mp) && sm->sm_agno != 0) - goto out; - if (xfs_has_rtgroups(mp) && sm->sm_agno >= mp->m_sb.sb_rgcount) - goto out; + if (xfs_has_rtgroups(mp)) { + if (sm->sm_agno >= mp->m_sb.sb_rgcount) { + if (sm->sm_agno == 0) + error = -ENOENT; + goto out; + } + } else { + if (sm->sm_agno != 0) + goto out; + } break; default: goto out;