public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <clm@fb.com>
To: Nicholas Krause <xerofoify@gmail.com>
Cc: <jbacik@fb.com>, <dsterba@suse.com>,
	<linux-btrfs@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RESEND] btrfs:Fix incorrect return statement if failure occurs in the function  btrfs_mark_extent_written
Date: Wed, 30 Dec 2015 16:07:36 -0500	[thread overview]
Message-ID: <20151230210736.24bgnuxycchlsusd@ret.masoncoding.com> (raw)
In-Reply-To: <1451438447-23679-1-git-send-email-xerofoify@gmail.com>

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


           reply	other threads:[~2015-12-30 21:08 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1451438447-23679-1-git-send-email-xerofoify@gmail.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151230210736.24bgnuxycchlsusd@ret.masoncoding.com \
    --to=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=jbacik@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xerofoify@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox