All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Josef Bacik <josef@toxicpanda.com>,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] btrfs: abort the transaction if we fail to replay log trees
Date: Thu, 20 May 2021 09:08:09 +0800	[thread overview]
Message-ID: <bdf7c194-c14b-1b36-02ad-e67743fbbfef@gmx.com> (raw)
In-Reply-To: <9513d31a4d2559253088756f99d162abaf090ebd.1621438132.git.josef@toxicpanda.com>



On 2021/5/19 下午11:29, Josef Bacik wrote:
> During inspection of the return path for replay I noticed that we don't
> actually abort the transaction if we get a failure during replay.  This
> isn't a problem necessarily, as we properly return the error and will
> fail to mount.  However we still leave this dangling transaction that
> could conceivably be committed without thinking there was an error.
> Handle this by making sure we abort the transaction on error to
> safeguard us from any problems in the future.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>   fs/btrfs/tree-log.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index 4dc74949040d..18009095908b 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -6352,8 +6352,10 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
>
>   	return 0;
>   error:
> -	if (wc.trans)
> +	if (wc.trans) {
> +		btrfs_abort_transaction(wc.trans, ret);
>   		btrfs_end_transaction(wc.trans);
> +	}
>   	btrfs_free_path(path);
>   	return ret;
>   }
>

      parent reply	other threads:[~2021-05-20  1:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 15:29 [PATCH] btrfs: abort the transaction if we fail to replay log trees Josef Bacik
2021-05-19 16:22 ` Johannes Thumshirn
2021-05-19 20:15   ` David Sterba
2021-05-19 20:22     ` Josef Bacik
2021-05-20 13:16       ` David Sterba
2021-05-20  1:08 ` Qu Wenruo [this message]

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=bdf7c194-c14b-1b36-02ad-e67743fbbfef@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 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.