]> Git Repo - linux.git/commitdiff
ext4: fix warning when turn on dioread_nolock and inline_data
authoryangerkun <[email protected]>
Sun, 11 Aug 2019 20:27:41 +0000 (16:27 -0400)
committerTheodore Ts'o <[email protected]>
Sun, 11 Aug 2019 20:27:41 +0000 (16:27 -0400)
mkfs.ext4 -O inline_data /dev/vdb
mount -o dioread_nolock /dev/vdb /mnt
echo "some inline data..." >> /mnt/test-file
echo "some inline data..." >> /mnt/test-file
sync

The above script will trigger "WARN_ON(!io_end->handle && sbi->s_journal)"
because ext4_should_dioread_nolock() returns false for a file with inline
data. Move the check to a place after we have already removed the inline
data and prepared inode to write normal pages.

Reviewed-by: Jan Kara <[email protected]>
Signed-off-by: yangerkun <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
fs/ext4/inode.c

index 420fe3deed39702b93a5567dbebe77a8e4b6b992..a6523516d6819b1317c01c2a5c5effbb86d5c319 100644 (file)
@@ -2785,15 +2785,6 @@ static int ext4_writepages(struct address_space *mapping,
                goto out_writepages;
        }
 
-       if (ext4_should_dioread_nolock(inode)) {
-               /*
-                * We may need to convert up to one extent per block in
-                * the page and we may dirty the inode.
-                */
-               rsv_blocks = 1 + ext4_chunk_trans_blocks(inode,
-                                               PAGE_SIZE >> inode->i_blkbits);
-       }
-
        /*
         * If we have inline data and arrive here, it means that
         * we will soon create the block for the 1st page, so
@@ -2812,6 +2803,15 @@ static int ext4_writepages(struct address_space *mapping,
                ext4_journal_stop(handle);
        }
 
+       if (ext4_should_dioread_nolock(inode)) {
+               /*
+                * We may need to convert up to one extent per block in
+                * the page and we may dirty the inode.
+                */
+               rsv_blocks = 1 + ext4_chunk_trans_blocks(inode,
+                                               PAGE_SIZE >> inode->i_blkbits);
+       }
+
        if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
                range_whole = 1;
 
This page took 0.060441 seconds and 4 git commands to generate.