[RHEL7,COMMIT] ms/ext4: don't ignore return values from ext4_ext_dirty()

Submitted by Vasily Averin on March 3, 2021, 4:43 p.m.

Details

Message ID 202103031643.123GhkOc015089@vz7build.vvs.sw.ru
State New
Series "ext4: more error hanglings (ports from mainstream)"
Headers show

Commit Message

Vasily Averin March 3, 2021, 4:43 p.m.
The commit is pushed to "branch-rh7-3.10.0-1160.15.2.vz7.173.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.15.2.vz7.173.3
------>
commit 6ae4467a0cce84dedd5dddf48e3f364227ecadd6
Author: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Date:   Wed Mar 3 19:43:46 2021 +0300

    ms/ext4: don't ignore return values from ext4_ext_dirty()
    
    Don't ignore return values from ext4_ext_dirty, since the errors
    indicate valid failures below Ext4.  In all of the other instances of
    ext4_ext_dirty calls, the error return value is handled in some
    way. This patch makes those remaining couple of places to handle
    ext4_ext_dirty errors as well. In case of ext4_split_extent_at(), the
    ignorance of return value is intentional. The reason is that we are
    already in error path and there isn't much we can do if ext4_ext_dirty
    returns error. This patch adds a comment for that case explaining why
    we ignore the return value.
    
    In the longer run, we probably should
    make sure that errors from other mark_dirty routines are handled as
    well.
    
    Ran gce-xfstests smoke tests and verified that there were no
    regressions.
    
    Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
    Reviewed-by: Jan Kara <jack@suse.cz>
    Link: https://lore.kernel.org/r/20200427013438.219117-2-harshadshirwadkar@gmail.com
    Signed-off-by: Theodore Ts'o <tytso@mit.edu>
    
    (cherry picked from commit b60ca3343e78761c6ebe6ff52c628893c8297b73)
    Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 fs/ext4/extents.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 47ce9c9..cb31585 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3302,6 +3302,10 @@  out:
 
 fix_extent_len:
 	ex->ee_len = orig_ex.ee_len;
+	/*
+	 * Ignore ext4_ext_dirty return value since we are already in error path
+	 * and err is a non-zero error code.
+	 */
 	ext4_ext_dirty(handle, inode, path + path->p_depth);
 	return err;
 }
@@ -3560,7 +3564,7 @@  static int ext4_ext_convert_to_initialized(handle_t *handle,
 	}
 	if (allocated) {
 		/* Mark the block containing both extents as dirty */
-		ext4_ext_dirty(handle, inode, path + depth);
+		err = ext4_ext_dirty(handle, inode, path + depth);
 
 		/* Update path to point to the right extent */
 		path[depth].p_ext = abut_ex;