[Devel] [PATCH RHEL7 COMMIT] ext4: writecounters leak in ext4_convert_unwritten_extents()

Konstantin Khorenko khorenko at virtuozzo.com
Fri May 22 13:37:05 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.8.2.vz7.151.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.8.2.vz7.151.4
------>
commit 9f50c56e038585e8a1e0e0978074b7ddfdfe0ffb
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Fri May 22 13:37:04 2020 +0300

    ext4: writecounters leak in ext4_convert_unwritten_extents()
    
    sb_start_intwrite() increased sb.s_writers counter
    but balanced sb_end_intwrite() was not called.
    As result fs_freeze attempt can hang forever.
    
    Fixes e86034daac1898 ("ext4: fix race aio-dio vs freeze_fs")
    
    https://jira.sw.ru/browse/PSBM-104084
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 fs/ext4/extents.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 2c2bc9d220989..78dd03a0453c4 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -5088,8 +5088,10 @@ int ext4_convert_unwritten_extents(handle_t *handle, struct inode *inode,
 	if (handle) {
 		handle = ext4_journal_start_reserved(handle,
 						     EXT4_HT_EXT_CONVERT);
-		if (IS_ERR(handle))
+		if (IS_ERR(handle)) {
+			sb_end_intwrite(inode->i_sb);
 			return PTR_ERR(handle);
+		}
 		credits = 0;
 	} else {
 		/*


More information about the Devel mailing list