All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kent Overstreet <kmo-PEzghdH756F8UrSeD/g0lQ@public.gmane.org>
To: Hubert Kempkensteffen
	<hubert-39zlLzowylnAQEp6PLVxx6xOck334EZe@public.gmane.org>
Cc: linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] bcache: Possible flush fix
Date: Tue, 17 Sep 2013 14:40:43 -0700	[thread overview]
Message-ID: <20130917214043.GF32037@kmo-pixel> (raw)
In-Reply-To: <loom.20130917T224603-574-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>

Jens suggested that cloning the bio to issue a bare flush might be
copying some flags we don't want, and at least allocating a new bio
would be more correct. Worth a shot...

Signed-off-by: Kent Overstreet <kmo-PEzghdH756F8UrSeD/g0lQ@public.gmane.org>
---

On Tue, Sep 17, 2013 at 08:54:57PM +0000, Hubert Kempkensteffen wrote:
> Kent Overstreet <kmo@...> writes:
> Sorry, my english.
> I have no raid and no LVM. There are both ordinary machines.
> And I just want to speed up the data disk!
> 
> > 
> > I think this bug requires something else in the stack to trigger, I'm
> > trying to figure out what the common factor is.

Can you give this patch a try?

 drivers/md/bcache/request.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index afb9a99..c06840b 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -1053,19 +1053,21 @@ static void request_write(struct cached_dev *dc, struct search *s)
 		trace_bcache_writethrough(s->orig_bio);
 		closure_bio_submit(bio, cl, s->d);
 	} else {
+		s->op.cache_bio = bio;
 		trace_bcache_writeback(s->orig_bio);
 		bch_writeback_add(dc, bio_sectors(bio));
 
-		if (s->op.flush_journal) {
+		if (bio->bi_rw & REQ_FLUSH) {
 			/* Also need to send a flush to the backing device */
-			s->op.cache_bio = bio_clone_bioset(bio, GFP_NOIO,
-							   dc->disk.bio_split);
-
-			bio->bi_size = 0;
-			bio->bi_vcnt = 0;
-			closure_bio_submit(bio, cl, s->d);
-		} else {
-			s->op.cache_bio = bio;
+			struct bio *flush = bio_alloc_bioset(0, GFP_NOIO,
+							     dc->disk.bio_split);
+
+			flush->bi_rw	= WRITE_FLUSH;
+			flush->bi_bdev	= bio->bi_bdev;
+			flush->bi_end_io = request_endio;
+			flush->bi_private = cl;
+
+			closure_bio_submit(flush, cl, s->d);
 		}
 	}
 out:
-- 
1.8.4.rc3

  parent reply	other threads:[~2013-09-17 21:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-16 13:07 Bcache hangs with Debian 7 (Wheezy), sync does not come back Hubert Kempkensteffen
     [not found] ` <loom.20130916T150548-751-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2013-09-17  2:03   ` Kent Overstreet
2013-09-17 10:23     ` Hubert Kempkensteffen
     [not found]       ` <loom.20130917T122135-908-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2013-09-17 20:37         ` Kent Overstreet
2013-09-17 20:54           ` Hubert Kempkensteffen
     [not found]             ` <loom.20130917T224603-574-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2013-09-17 21:15               ` Josep Lladonosa
2013-09-17 21:34               ` Kent Overstreet
2013-09-17 21:40               ` Kent Overstreet [this message]
2013-09-18 13:57                 ` [PATCH] bcache: Possible flush fix Hubert Kempkensteffen
     [not found]                   ` <loom.20130918T134845-142-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2013-09-18 20:28                     ` Kent Overstreet
2013-09-18 20:39                       ` Hubert Kempkensteffen
     [not found]                         ` <loom.20130918T223347-893-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2013-09-18 20:43                           ` Kent Overstreet
2013-09-18 21:28                             ` Hubert Kempkensteffen
2013-09-19  8:52                             ` Hubert Kempkensteffen
2013-09-19 18:26                             ` Hubert Kempkensteffen
     [not found]                               ` <loom.20130919T202224-113-eS7Uydv5nfjZ+VzJOa5vwg@public.gmane.org>
2013-10-13 20:54                                 ` Rolf Fokkens
2013-09-18 17:05                 ` Hubert Kempkensteffen

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=20130917214043.GF32037@kmo-pixel \
    --to=kmo-pezghdh756f8ursed/g0lq@public.gmane.org \
    --cc=hubert-39zlLzowylnAQEp6PLVxx6xOck334EZe@public.gmane.org \
    --cc=linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.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.