]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: support xrep_require_rtext_inuse on zoned file systems
authorChristoph Hellwig <hch@lst.de>
Mon, 22 Jul 2024 13:31:28 +0000 (06:31 -0700)
committerChristoph Hellwig <hch@lst.de>
Tue, 5 Nov 2024 08:29:54 +0000 (09:29 +0100)
Space usage is tracked by the rmap, which already is separately
cross-reference.  But on top of that we have the write pointer and can
do a basic sanity check here that the block is not beyond the write
pointer.

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/xfs/scrub/repair.c

index 90740718ac70d3fa6a1f80f14f90a7cb953b4d02..985c1f19fa6cdd6d72ffdee1233dbf2051e5598c 100644 (file)
@@ -1048,7 +1048,13 @@ xrep_require_rtext_inuse(
        xfs_rtxnum_t            startrtx;
        xfs_rtxnum_t            endrtx;
        bool                    is_free = false;
-       int                     error;
+       int                     error = 0;
+
+       if (xfs_has_zoned(mp)) {
+               if (rgbno + len > sc->sr.rtg->rtg_write_pointer)
+                       return -EFSCORRUPTED;
+               return 0;
+       }
 
        startrtx = xfs_rgbno_to_rtx(mp, rgbno);
        endrtx = xfs_rgbno_to_rtx(mp, rgbno + len - 1);