linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: test for device flush-able should be after wait code
Date: Wed, 14 Jun 2017 22:01:05 +0800	[thread overview]
Message-ID: <6f0a0979-3411-5fff-f241-f5cd2060b4b6@oracle.com> (raw)
In-Reply-To: <20170614122637.GA25451@suse.cz>



On 06/14/2017 08:26 PM, David Sterba wrote:
> On Wed, Jun 14, 2017 at 06:02:38PM +0800, Anand Jain wrote:
>> write_dev_flush() checks if the device is flush capable, however as
>> the device mode can change any time, this check should be after the
>> wait part of the code.
> 
> This would apply to code before "btrfs: wait part of the
> write_dev_flush() can be separated out", right?

  Yes.

> The problematic case is when a flush bio is sent, queue status changes
> and waiting is skipped. A bio would leak. Next time the flushing is
> enabled, write_dev_flush allocaes a new bio and either it would leak or
> waiting will happen as expected.
> 
> The bio would leak only if the barriers are switched between write and
> wait. Not impossible, but I still think a race hard to win. The
> consequences are not absolutely fatal.

  Yeah more of a theoretical problem and hard to reproduce unless there
  is a deliberate attempt.

> Also, the cleanups in write_dev_flush fix the bug in another way, so we
> don't need this separate patch as a potential stable backport. The patch
> mentioned above can be considered a fix but would need some manual
> adaptations to apply. Therefore I don't think we need the $subj patch.

  Agreed. Kindly ignore this and the V2.2 of
     [PATCH 3/3 v2.2] btrfs: wait part of the write_dev_flush()...
  patch as well.

Thanks, Anand

      reply	other threads:[~2017-06-14 13:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 10:02 [PATCH] btrfs: test for device flush-able should be after wait code Anand Jain
2017-06-14 12:26 ` David Sterba
2017-06-14 14:01   ` Anand Jain [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=6f0a0979-3411-5fff-f241-f5cd2060b4b6@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@suse.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).