Skip to content

Commit 812c0ca

Browse files
committed
ext4: make sure enough credits are reserved for dioread_nolock writes
There are enough credits reserved for most dioread_nolock writes; however, if the extent tree is sufficiently deep, and/or quota is enabled, the code was not allowing for all eventualities when reserving journal credits for the unwritten extent conversion. This problem can be seen using xfstests ext4/034: WARNING: CPU: 1 PID: 257 at fs/ext4/ext4_jbd2.c:271 __ext4_handle_dirty_metadata+0x10c/0x180 Workqueue: ext4-rsv-conversion ext4_end_io_rsv_work RIP: 0010:__ext4_handle_dirty_metadata+0x10c/0x180 ... EXT4-fs: ext4_free_blocks:4938: aborting transaction: error 28 in __ext4_handle_dirty_metadata EXT4: jbd2_journal_dirty_metadata failed: handle type 11 started at line 4921, credits 4/0, errcode -28 EXT4-fs error (device dm-1) in ext4_free_blocks:4950: error 28 Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@kernel.org
1 parent 18f2c4f commit 812c0ca

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/ext4/inode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2778,7 +2778,8 @@ static int ext4_writepages(struct address_space *mapping,
27782778
* We may need to convert up to one extent per block in
27792779
* the page and we may dirty the inode.
27802780
*/
2781-
rsv_blocks = 1 + (PAGE_SIZE >> inode->i_blkbits);
2781+
rsv_blocks = 1 + ext4_chunk_trans_blocks(inode,
2782+
PAGE_SIZE >> inode->i_blkbits);
27822783
}
27832784

27842785
/*

0 commit comments

Comments
 (0)