linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Anand Jain <anand.jain@oracle.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: test for device flush-able should be after wait code
Date: Wed, 14 Jun 2017 14:26:37 +0200	[thread overview]
Message-ID: <20170614122637.GA25451@suse.cz> (raw)
In-Reply-To: <1497434558-715-1-git-send-email-anand.jain@oracle.com>

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?

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.

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.

  reply	other threads:[~2017-06-14 12:27 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 [this message]
2017-06-14 14:01   ` Anand Jain

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=20170614122637.GA25451@suse.cz \
    --to=dsterba@suse.cz \
    --cc=anand.jain@oracle.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 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).