mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-13 16:50:05 +00:00
ext4: fix a potential fiemap/page fault deadlock w/ inline_data
The ext4_inline_data_fiemap() function calls fiemap_fill_next_extent() while still holding the xattr semaphore. This is not necessary and it triggers a circular lockdep warning. This is because fiemap_fill_next_extent() could trigger a page fault when it writes into page which triggers a page fault. If that page is mmaped from the inline file in question, this could very well result in a deadlock. This problem can be reproduced using generic/519 with a file system configuration which has the inline_data feature enabled. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@kernel.org
This commit is contained in:
parent
812c0cab2c
commit
2b08b1f12c
@ -1890,12 +1890,12 @@ int ext4_inline_data_fiemap(struct inode *inode,
|
|||||||
physical += (char *)ext4_raw_inode(&iloc) - iloc.bh->b_data;
|
physical += (char *)ext4_raw_inode(&iloc) - iloc.bh->b_data;
|
||||||
physical += offsetof(struct ext4_inode, i_block);
|
physical += offsetof(struct ext4_inode, i_block);
|
||||||
|
|
||||||
if (physical)
|
|
||||||
error = fiemap_fill_next_extent(fieinfo, start, physical,
|
|
||||||
inline_len, flags);
|
|
||||||
brelse(iloc.bh);
|
brelse(iloc.bh);
|
||||||
out:
|
out:
|
||||||
up_read(&EXT4_I(inode)->xattr_sem);
|
up_read(&EXT4_I(inode)->xattr_sem);
|
||||||
|
if (physical)
|
||||||
|
error = fiemap_fill_next_extent(fieinfo, start, physical,
|
||||||
|
inline_len, flags);
|
||||||
return (error < 0 ? error : 0);
|
return (error < 0 ? error : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user