Re: [PATCH 2/6] xfs: check rt summary file geometry more thoroughly

Darrick J. Wong
2023-11-30T00:10:47Z

On Tue, Nov 28, 2023 at 10:23:41PM -0800, Christoph Hellwig wrote:
> On Tue, Nov 28, 2023 at 10:21:55PM -0800, Darrick J. Wong wrote:
> > On Tue, Nov 28, 2023 at 10:05:49PM -0800, Christoph Hellwig wrote:
> > > On Tue, Nov 28, 2023 at 03:30:09PM -0800, Darrick J. Wong wrote:
> > > > LOL so I just tried a 64k rt volume with a 1M rextsize and mkfs crashed.
> > > > I guess I'll go sort out what's going on there...
> > >
> > > I think we should just reject rt device size < rtextsize configs in
> > > the kernel and all tools.
> >
> > "But that could break old weirdass customer filesystems."
> >
> > The design of rtgroups prohibits that, so we're ok going forward.
>
> Well, as you just said it hasn't mounted for a long time, and really
> this is a corner case that just doesn't make any sense. I'd really
> prefer to cleanly reject it, and if someone really complains with a good
> reason we can revisit the decisions. But I strongly doubt it's ever
> going to happen.

Oh, even better, Dave and I noticed today that if you format a 17G
realtime volume (> 2^32 rt extents) then mkfs fails because there's an
integer overflow:

https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/tree/mkfs/xfs_mkfs.c#n3739

Based on your observation that rt free space never exceeds the group
length with rtgroups turned on, I'll tweak the sb_rextslog computation
so that it's computed with (rgblocks / rextsize) instead of (rblocks /
rextsize) which will fix that problem for future filesystems.

--D