1 ext4: ext4_da_convert_inline_data_to_extent drop locked page after error
3 From: Dmitry Monakhov <dmonakhov@openvz.org>
7 MKFS_OPTIONS="-q -I 256 -O inline_data,64bit"
10 [<ffffffff81144c76>] lock_page+0x35/0x39 -------> DEADLOCK
11 [<ffffffff81145260>] pagecache_get_page+0x65/0x15a
12 [<ffffffff811507fc>] truncate_inode_pages_range+0x1db/0x45c
13 [<ffffffff8120ea63>] ? ext4_da_get_block_prep+0x439/0x4b6
14 [<ffffffff811b29b7>] ? __block_write_begin+0x284/0x29c
15 [<ffffffff8120e62a>] ? ext4_change_inode_journal_flag+0x16b/0x16b
16 [<ffffffff81150af0>] truncate_inode_pages+0x12/0x14
17 [<ffffffff81247cb4>] ext4_truncate_failed_write+0x19/0x25
18 [<ffffffff812488cf>] ext4_da_write_inline_data_begin+0x196/0x31c
19 [<ffffffff81210dad>] ext4_da_write_begin+0x189/0x302
20 [<ffffffff810c07ac>] ? trace_hardirqs_on+0xd/0xf
21 [<ffffffff810ddd13>] ? read_seqcount_begin.clone.1+0x9f/0xcc
22 [<ffffffff8114309d>] generic_perform_write+0xc7/0x1c6
23 [<ffffffff810c040e>] ? mark_held_locks+0x59/0x77
24 [<ffffffff811445d1>] __generic_file_write_iter+0x17f/0x1c5
25 [<ffffffff8120726b>] ext4_file_write_iter+0x2a5/0x354
26 [<ffffffff81185656>] ? file_start_write+0x2a/0x2c
27 [<ffffffff8107bcdb>] ? bad_area_nosemaphore+0x13/0x15
28 [<ffffffff811858ce>] new_sync_write+0x8a/0xb2
29 [<ffffffff81186e7b>] vfs_write+0xb5/0x14d
30 [<ffffffff81186ffb>] SyS_write+0x5c/0x8c
31 [<ffffffff816f2529>] system_call_fastpath+0x12/0x17
33 Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
34 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
36 fs/ext4/inline.c | 5 ++++-
37 1 files changed, 4 insertions(+), 1 deletions(-)
40 - drop xattr_sem before ext4_truncate_failed_write() because
41 ext4_inline_data_truncate() depends on it.
43 diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
44 index d3d8192..acd79b7 100644
45 --- a/fs/ext4/inline.c
46 +++ b/fs/ext4/inline.c
47 @@ -811,8 +811,11 @@ static int ext4_da_convert_inline_data_to_extent(struct address_space *mapping,
48 ret = __block_write_begin(page, 0, inline_size,
49 ext4_da_get_block_prep);
51 + up_read(&EXT4_I(inode)->xattr_sem);
53 + page_cache_release(page);
54 ext4_truncate_failed_write(inode);