This is a note to let you know that I've just added the patch titled bcache: Fix flushes in writeback mode to the 3.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: bcache-fix-flushes-in-writeback-mode.patch and it can be found in the queue-3.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From c0f04d88e46d14de51f4baebb6efafb7d59e9f96 Mon Sep 17 00:00:00 2001 From: Kent Overstreet <kmo@xxxxxxxxxxxxx> Date: Mon, 23 Sep 2013 23:17:36 -0700 Subject: bcache: Fix flushes in writeback mode From: Kent Overstreet <kmo@xxxxxxxxxxxxx> commit c0f04d88e46d14de51f4baebb6efafb7d59e9f96 upstream. In writeback mode, when we get a cache flush we need to make sure we issue a flush to the backing device. The code for sending down an extra flush was wrong - by cloning the bio we were probably getting flags that didn't make sense for a bare flush, and also the old code was firing for FUA bios, for which we don't need to send a flush to the backing device. This was causing data corruption somehow - the mechanism was never determined, but this patch fixes it for the users that were seeing it. Signed-off-by: Kent Overstreet <kmo@xxxxxxxxxxxxx> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/md/bcache/request.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -1056,14 +1056,17 @@ static void request_write(struct cached_ 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); + struct bio *flush = bio_alloc_bioset(0, GFP_NOIO, + dc->disk.bio_split); - bio->bi_size = 0; - bio->bi_vcnt = 0; - closure_bio_submit(bio, cl, s->d); + 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); } else { s->op.cache_bio = bio; } Patches currently in stable-queue which might be from kmo@xxxxxxxxxxxxx are queue-3.10/bcache-fix-a-flush-fua-performance-bug.patch queue-3.10/bcache-fix-for-when-no-journal-entries-are-found.patch queue-3.10/block-fix-bio_copy_data.patch queue-3.10/bcache-fix-for-handling-overlapping-extents-when-reading-in-a-btree-node.patch queue-3.10/bcache-fix-a-dumb-cpu-spinning-bug-in-writeback.patch queue-3.10/bcache-strip-endline-when-writing-the-label-through-sysfs.patch queue-3.10/bcache-fix-flushes-in-writeback-mode.patch queue-3.10/bcache-fix-a-shrinker-deadlock.patch queue-3.10/bcache-fix-a-writeback-performance-regression.patch queue-3.10/bcache-fix-a-dumb-journal-discard-bug.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html