[Devel] [PATCH RHEL7 COMMIT] ext4: make sure enough credits are reserved for

Vasily Averin vvs at virtuozzo.com
Sat Jul 25 09:21:34 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.10.1.vz7.162.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.10.1.vz7.162.14
------>
commit 96ee1dd6f8f9a12741f3e5df71874d76aaba693d
Author: Theodore Ts'o <tytso at mit.edu>
Date:   Sat Jul 25 09:21:15 2020 +0300

    ext4: make sure enough credits are reserved for
    
    ms commit 812c0cab2c0dfad977605dbadf9148490ca5d93f.
    
    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 at mit.edu>
    Cc: stable at kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/ext4/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index bc253a0f177c2..7c74fe3094374 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2451,7 +2451,8 @@ static int ext4_writepages(struct address_space *mapping,
 		 * We may need to convert up to one extent per block in
 		 * the page and we may dirty the inode.
 		 */
-		rsv_blocks = 1 + (PAGE_CACHE_SIZE >> inode->i_blkbits);
+		rsv_blocks = 1 + ext4_chunk_trans_blocks(inode,
+						PAGE_SIZE >> inode->i_blkbits);
 	}
 
 	/*


More information about the Devel mailing list