From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz
Subject: [PATCH] btrfs: test for device flush-able should be after wait code
Date: Wed, 14 Jun 2017 18:02:38 +0800 [thread overview]
Message-ID: <1497434558-715-1-git-send-email-anand.jain@oracle.com> (raw)
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.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Fixes: c2a9c7ab475b btrfs: check if the device is flush capable
---
fs/btrfs/disk-io.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 9f2ffe2c6afb..603a7e32e708 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -3496,13 +3496,10 @@ static void btrfs_end_empty_barrier(struct bio *bio)
*/
static int write_dev_flush(struct btrfs_device *device, int wait)
{
- struct request_queue *q = bdev_get_queue(device->bdev);
+ struct request_queue *devq;
struct bio *bio;
int ret = 0;
- if (!test_bit(QUEUE_FLAG_WC, &q->queue_flags))
- return 0;
-
if (wait) {
bio = device->flush_bio;
if (!bio)
@@ -3527,6 +3524,10 @@ static int write_dev_flush(struct btrfs_device *device, int wait)
return ret;
}
+ devq = bdev_get_queue(device->bdev);
+ if (!test_bit(QUEUE_FLAG_WC, &devq->queue_flags))
+ return 0;
+
/*
* one reference for us, and we leave it for the
* caller
--
2.7.0
next reply other threads:[~2017-06-14 9:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-14 10:02 Anand Jain [this message]
2017-06-14 12:26 ` [PATCH] btrfs: test for device flush-able should be after wait code David Sterba
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=1497434558-715-1-git-send-email-anand.jain@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).