History

xfs: don't allow bmap on rt files

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.

Darrick J. Wong committed 9 years ago

Commit eb5e2481 parent 95989c41 file · +5 −2Browse files

Unified · Split

fs/xfs/xfs_aops.c+5−2
@@ -1316,9 +1316,12 @@ xfs_vm_bmap( · 1315 unmodified lines
13161316 * The swap code (ab-)uses ->bmap to get a block mapping and then
13171317 * bypasseѕ the file system for actual I/O. We really can't allow
13181318 * that on reflinks inodes, so we have to skip out here. And yes,
1319− * 0 is the magic code for a bmap error..
1319+ * 0 is the magic code for a bmap error.
1320+ *
1321+ * Since we don't pass back blockdev info, we can't return bmap
1322+ * information for rt files either.
13201323 */
1321− if (xfs_is_reflink_inode(ip))
1324+ if (xfs_is_reflink_inode(ip) || XFS_IS_REALTIME_INODE(ip))
13221325 return 0;
13231326
13241327 filemap_write_and_wait(mapping);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t