]> www.infradead.org Git - users/hch/xfs.git/commit
xfs: unmapped buffer item size straddling mismatch
authorDave Chinner <dchinner@redhat.com>
Thu, 16 Jan 2025 03:58:58 +0000 (04:58 +0100)
committerChristoph Hellwig <hch@lst.de>
Tue, 4 Mar 2025 13:57:42 +0000 (06:57 -0700)
commit7147a983d56822e31b97d8316324750150589482
treed72ed0fcdf14c1fd7e0e89b164c130882f832ec9
parent9b47d37496e2669078c8616334e5a7200f91681a
xfs: unmapped buffer item size straddling mismatch

We never log large contiguous regions of unmapped buffers, so this
bug is never triggered by the current code. However, the slowpath
for formatting buffer straddling regions is broken.

That is, the size and shape of the log vector calculated across a
straddle does not match how the formatting code formats a straddle.
This results in a log vector with an uninitialised iovec and this
causes a crash when xlog_write_full() goes to copy the iovec into
the journal.

Whilst touching this code, don't bother checking mapped or single
folio buffers for discontiguous regions because they don't have
them. This significantly reduces the overhead of this check when
logging large buffers as calling xfs_buf_offset() is not free and
it occurs a *lot* in those cases.

Fixes: 929f8b0deb83 ("xfs: optimise xfs_buf_item_size/format for contiguous regions")
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_buf_item.c