Message ID | 20241211085636.1380516-35-hch@lst.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [01/43] xfs: constify feature checks | expand |
On Wed, Dec 11, 2024 at 09:54:59AM +0100, Christoph Hellwig wrote: > 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> Looks ok, Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> --D > --- > fs/xfs/scrub/repair.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c > index 90740718ac70..dd88a237d629 100644 > --- a/fs/xfs/scrub/repair.c > +++ b/fs/xfs/scrub/repair.c > @@ -43,6 +43,7 @@ > #include "xfs_rtalloc.h" > #include "xfs_metafile.h" > #include "xfs_rtrefcount_btree.h" > +#include "xfs_zone_alloc.h" > #include "scrub/scrub.h" > #include "scrub/common.h" > #include "scrub/trace.h" > @@ -1048,7 +1049,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 (!xfs_zone_rgbno_is_valid(sc->sr.rtg, rgbno + len - 1)) > + return -EFSCORRUPTED; > + return 0; > + } > > startrtx = xfs_rgbno_to_rtx(mp, rgbno); > endrtx = xfs_rgbno_to_rtx(mp, rgbno + len - 1); > -- > 2.45.2 > >
diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c index 90740718ac70..dd88a237d629 100644 --- a/fs/xfs/scrub/repair.c +++ b/fs/xfs/scrub/repair.c @@ -43,6 +43,7 @@ #include "xfs_rtalloc.h" #include "xfs_metafile.h" #include "xfs_rtrefcount_btree.h" +#include "xfs_zone_alloc.h" #include "scrub/scrub.h" #include "scrub/common.h" #include "scrub/trace.h" @@ -1048,7 +1049,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 (!xfs_zone_rgbno_is_valid(sc->sr.rtg, rgbno + len - 1)) + return -EFSCORRUPTED; + return 0; + } startrtx = xfs_rgbno_to_rtx(mp, rgbno); endrtx = xfs_rgbno_to_rtx(mp, rgbno + len - 1);
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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)