Patch "xfs: don't allow bmap on rt files" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
xfs: don't allow bmap on rt files
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
xfs-don-t-allow-bmap-on-rt-files.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
61d819e7bcb7f33da710bf3f5dcb2bcf1e48203cMon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <[email protected]>
Date: Mon, 19 Jun 2017 13:19:08 -0700
Subject: xfs: don't allow bmap on rt files
From: Darrick J. Wong <[email protected]>
commit 61d819e7bcb7f33da710bf3f5dcb2bcf1e48203c upstream.
bmap returns a dumb LBA address but not the block device that goes with that LBA. Swapfiles don't care about this and will blindly assume that the data volume is the correct blockdev, which is totally bogus for files on the rt subvolume. This results in the swap code doing IOs to arbitrary locations on the data device(!) if the passed in mapping is a realtime file, so just turn off bmap for rt files.
--- fs/xfs/xfs_aops.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/xfs/xfs_aops.c +5 -2
@@ -1566,9 +1566,12 @@ xfs_vm_bmap(* The swap code (ab-)uses ->bmap to get a block mapping and then * bypasseѕ the file system for actual I/O. We really can't allow * that on reflinks inodes, so we have to skip out here. And yes, -* 0 is the magic code for a bmap error.. +* 0 is the magic code for a bmap error. +* +* Since we don't pass back blockdev info, we can't return bmap +* information for rt files either. */ -if (xfs_is_reflink_inode (ip)) { +if (xfs_is_reflink_inode (ip) ||XFS_IS_REALTIME_INODE (ip)) {xfs_iunlock (ip,XFS_IOLOCK_SHARED );return 0 ; }
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/xfs-fix-inobt-inode-allocation-search-optimization.patch queue-4.9/xfs-try-to-avoid-blowing-out-the-transaction-reservation-when-bunmaping-a-shared-extent.patch queue-4.9/xfs-free-cowblocks-and-retry-on-buffered-write-enospc.patch queue-4.9/xfs-set-firstfsb-to-nullfsblock-before-feeding-it-to-_bmapi_write.patch queue-4.9/xfs-fix-quotacheck-dquot-id-overflow-infinite-loop.patch queue-4.9/xfs-remove-bli-from-ail-before-release-on-transaction-abort.patch queue-4.9/xfs-check-_btree_check_block-value.patch queue-4.9/xfs-don-t-allow-bmap-on-rt-files.patch queue-4.9/xfs-push-buffer-of-flush-locked-dquot-to-avoid-quotacheck-deadlock.patch queue-4.9/xfs-free-uncommitted-transactions-during-log-recovery.patch queue-4.9/xfs-don-t-crash-on-unexpected-holes-in-dir-attr-btrees.patch queue-4.9/xfs-fix-spurious-spin_is_locked-assert-failures-on-non-smp-kernels.patch queue-4.9/xfs-fix-per-inode-dax-flag-inheritance.patch queue-4.9/xfs-fix-multi-ag-deadlock-in-xfs_bunmapi.patch queue-4.9/xfs-move-handling-of-missing-page-into-one-place-in-xfs_find_get_desired_pgoff.patch queue-4.9/xfs-release-bli-from-transaction-properly-on-fs-shutdown.patch queue-4.9/xfs-check-_alloc_read_agf-buffer-pointer-before-using.patch