Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1299495 > unrolled thread

Re: [PATCH RESEND] btrfs:Fix incorrect return statement if failure occurs in the function btrfs_mark_extent_written

Started byChris Mason <clm@fb.com>
First post2015-12-30 22:10 +0100
Last post2015-12-30 22:10 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH RESEND] btrfs:Fix incorrect return statement if failure  occurs in the function  btrfs_mark_extent_written Chris Mason <clm@fb.com> - 2015-12-30 22:10 +0100

#1299495 — Re: [PATCH RESEND] btrfs:Fix incorrect return statement if failure occurs in the function btrfs_mark_extent_written

FromChris Mason <clm@fb.com>
Date2015-12-30 22:10 +0100
SubjectRe: [PATCH RESEND] btrfs:Fix incorrect return statement if failure occurs in the function btrfs_mark_extent_written
Message-ID<qLwam-3mE-9@gated-at.bofh.it>
On Tue, Dec 29, 2015 at 08:20:47PM -0500, Nicholas Krause wrote:
> This fixes the incorrect return statement if failure occurs by
> returning 0 rather then the variable ret which may hold a error
> code to signal when a failure has occurred in the function
> btrfs_mark_extent_written to its callers rather then always
> making this function appear to run successfully to its callers
> by always returning zero.
> 
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  fs/btrfs/file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> index b823fac..7a9ab8e 100644
> --- a/fs/btrfs/file.c
> +++ b/fs/btrfs/file.c
> @@ -1276,7 +1276,7 @@ again:
>  	}
>  out:
>  	btrfs_free_path(path);
> -	return 0;
> +	return ret;
>  }

We're checking ret higher up and aborting the transaction properly.
There is at least one place ret will be non-zero above that isn't an
error, but you're passing it to the caller here making them think it has
gone wrong.

-chris

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web