mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 23:34:05 +08:00
ocfs2: prohibit refcounted swapfiles
The swapfile mechanism calls bmap once to find all the swap file mappings, which means that we cannot properly support CoW remapping. Therefore, error out if the swap code tries to call bmap on a refcounted file. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
parent
86544fbd85
commit
06a7030581
@ -464,6 +464,15 @@ static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block)
|
||||
trace_ocfs2_bmap((unsigned long long)OCFS2_I(inode)->ip_blkno,
|
||||
(unsigned long long)block);
|
||||
|
||||
/*
|
||||
* 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 refcounted inodes, so we have to skip out here. And yes,
|
||||
* 0 is the magic code for a bmap error..
|
||||
*/
|
||||
if (ocfs2_is_refcount_inode(inode))
|
||||
return 0;
|
||||
|
||||
/* We don't need to lock journal system files, since they aren't
|
||||
* accessed concurrently from multiple nodes.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user