On Mon, Aug 25, 2025 at 01:19:35PM +0200, Christoph Hellwig wrote: > Add a bt_nr_blocks to track the number of blocks in each buftarg, and > replace the check that hard codes sb_dblock in xfs_buf_map_verify with > this new value so that it is correct for non-ddev buftargs. The > RT buftarg only has a superblock in the first block, so it is unlikely > to trigger this, or are we likely to ever have enough blocks in the > in-memory buftargs, but we might as well get the check right. > > Fixes: 10616b806d1d ("xfs: fix _xfs_buf_find oops on blocks beyond the filesystem end") > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > --- > fs/xfs/xfs_buf.c | 38 +++++++++++++++++++---------------- > fs/xfs/xfs_buf.h | 4 +++- > fs/xfs/xfs_buf_item_recover.c | 7 +++++++ > fs/xfs/xfs_super.c | 7 ++++--- > fs/xfs/xfs_trans.c | 21 +++++++++---------- > 5 files changed, 45 insertions(+), 32 deletions(-) .... > diff --git a/fs/xfs/xfs_buf_item_recover.c b/fs/xfs/xfs_buf_item_recover.c > index 5d58e2ae4972..d43234e04174 100644 > --- a/fs/xfs/xfs_buf_item_recover.c > +++ b/fs/xfs/xfs_buf_item_recover.c > @@ -736,6 +736,13 @@ xlog_recover_do_primary_sb_buffer( > */ > xfs_sb_from_disk(&mp->m_sb, dsb); > > + /* > + * Grow can change the device size. Mirror that into the buftarg. > + */ > + mp->m_ddev_targp->bt_nr_blocks = mp->m_sb.sb_dblocks; > + if (mp->m_rtdev_targp && mp->m_rtdev_targp != mp->m_ddev_targp) > + mp->m_rtdev_targp->bt_nr_blocks = mp->m_sb.sb_dblocks; ^ That's not right. Perhaps we need some growfs crash/recovery tests to exercise this code.... -Dave. -- Dave Chinner david@xxxxxxxxxxxxx