1 ext4: fix warning when turn on dioread_nolock and inline_data
3 From: yangerkun <yangerkun@huawei.com>
5 mkfs.ext4 -O inline_data /dev/vdb
6 mount -o dioread_nolock /dev/vdb /mnt
7 echo "some inline data..." >> /mnt/test-file
8 echo "some inline data..." >> /mnt/test-file
11 The above script will trigger "WARN_ON(!io_end->handle && sbi->s_journal)"
12 because ext4_should_dioread_nolock() returns false for a file with inline
13 data. Move the check to a place after we have already removed the inline
14 data and prepared inode to write normal pages.
16 Reviewed-by: Jan Kara <jack@suse.cz>
17 Signed-off-by: yangerkun <yangerkun@huawei.com>
18 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
20 fs/ext4/inode.c | 18 +++++++++---------
21 1 file changed, 9 insertions(+), 9 deletions(-)
23 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
24 index c7f77c6..3f2a366 100644
27 @@ -2769,15 +2769,6 @@ static int ext4_writepages(struct address_space *mapping,
31 - if (ext4_should_dioread_nolock(inode)) {
33 - * We may need to convert up to one extent per block in
34 - * the page and we may dirty the inode.
36 - rsv_blocks = 1 + ext4_chunk_trans_blocks(inode,
37 - PAGE_SIZE >> inode->i_blkbits);
41 * If we have inline data and arrive here, it means that
42 * we will soon create the block for the 1st page, so
43 @@ -2796,6 +2787,15 @@ static int ext4_writepages(struct address_space *mapping,
44 ext4_journal_stop(handle);
47 + if (ext4_should_dioread_nolock(inode)) {
49 + * We may need to convert up to one extent per block in
50 + * the page and we may dirty the inode.
52 + rsv_blocks = 1 + ext4_chunk_trans_blocks(inode,
53 + PAGE_SIZE >> inode->i_blkbits);
56 if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)