]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: return -ENOENT when trying to scrub non-existing rtgroup xfs-per-rtg-bitmap-rebase
authorChristoph Hellwig <hch@lst.de>
Sun, 4 Aug 2024 09:51:16 +0000 (11:51 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 6 Aug 2024 13:05:17 +0000 (06:05 -0700)
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 <hch@lst.de>
fs/xfs/scrub/scrub.c

index f942141c65398419f66aeedc6d3c129bff4a3182..51f155c5596dc926a6d5c60d1c662769a7749ea4 100644 (file)
@@ -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;