All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ext4: don't ignore return values from ext4_ext_dirty()
@ 2020-04-21  3:02 Harshad Shirwadkar
  2020-04-23 15:46 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Harshad Shirwadkar @ 2020-04-21  3:02 UTC (permalink / raw)
  To: linux-ext4; +Cc: Harshad Shirwadkar

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.

Changes since V1:
Fixed incorrect return value handling in ext4_split_extent_at()

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
---
 fs/ext4/extents.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index f2b577b315a0..6425f4f9a197 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3244,6 +3244,10 @@ static int ext4_split_extent_at(handle_t *handle,
 
 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;
 }
@@ -3503,7 +3507,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;
-- 
2.26.1.301.g55bc3eb7cb9-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] ext4: don't ignore return values from ext4_ext_dirty()
  2020-04-21  3:02 [PATCH v2] ext4: don't ignore return values from ext4_ext_dirty() Harshad Shirwadkar
@ 2020-04-23 15:46 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2020-04-23 15:46 UTC (permalink / raw)
  To: Harshad Shirwadkar; +Cc: linux-ext4

On Mon 20-04-20 20:02:47, Harshad Shirwadkar wrote:
> 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.
> 
> Changes since V1:
> Fixed incorrect return value handling in ext4_split_extent_at()

The 'Changes' part should go below the '---' separator. There's no need to
have it included in the final commit message.

> Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>

Otherwise the patch looks good to me. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/extents.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index f2b577b315a0..6425f4f9a197 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -3244,6 +3244,10 @@ static int ext4_split_extent_at(handle_t *handle,
>  
>  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;
>  }
> @@ -3503,7 +3507,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;
> -- 
> 2.26.1.301.g55bc3eb7cb9-goog
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-23 15:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21  3:02 [PATCH v2] ext4: don't ignore return values from ext4_ext_dirty() Harshad Shirwadkar
2020-04-23 15:46 ` Jan Kara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.