Re: [PATCH 1/6] xfs: check rt bitmap file geometry more thoroughly

Christoph Hellwig
2023-11-29T06:05:07Z

On Tue, Nov 28, 2023 at 03:27:40PM -0800, Darrick J. Wong wrote:
> > All these will be 0 if mp->m_sb.sb_rblocks, and rtb is zeroed allocation
> > right above, so calculating the values seems a bit odd. Why not simply:
> >
> > if (mp->m_sb.sb_rblocks) {
> > rtb->rextents = xfs_rtb_to_rtx(mp, mp->m_sb.sb_rblocks);
> > rtb->rextslog = xfs_highbit32(rtb->rextents);
>
> Well... xfs_highbit32 returns -1 if its argument is zero, which is
> possible for the nasty edge case of (say) a 64k block device and a
> realtime extent size of 1MB, which results in rblocks > 0 and
> rextents == 0.

Eww. How do we even allow creating a mounting that? Such a
configuration doesn't make any sense.