public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
From: Kent Overstreet <kent.overstreet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Data corruption with bcache in 3.11
Date: Thu, 19 Sep 2013 19:35:01 -0700	[thread overview]
Message-ID: <20130920023501.GJ17891@kmo-pixel> (raw)

If you were one of the users seeing data corruption in 3.11 but not any
of the 3.10 stable kernel, I think I just fixed it. It's now clearer why
it was only hitting some users, too...

I want to get confirmation from someone who was seeing it that it fixes
the issue, so please test the fix and let me know what happens. It's in
my bcache-data-corruption-fix branch, and the patch is below:

commit 97ad43a31a7ea3c23a4eb64b8e26aad3cf21ae8d
Author: Kent Overstreet <kmo-PEzghdH756F8UrSeD/g0lQ@public.gmane.org>
Date:   Thu Sep 19 19:10:24 2013 -0700

    block: Fix bio_copy_data()
    
    The memcpy() in bio_copy_data() was using the wrong offset vars, leading
    to data corruption in weird unusual setups.
    
    Signed-off-by: Kent Overstreet <kmo-PEzghdH756F8UrSeD/g0lQ@public.gmane.org>
    Cc: linux-stable <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org> # >= v3.9

diff --git a/fs/bio.c b/fs/bio.c
index c5eae72..5e7507d 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -917,8 +917,8 @@ void bio_copy_data(struct bio *dst, struct bio *src)
 		src_p = kmap_atomic(src_bv->bv_page);
 		dst_p = kmap_atomic(dst_bv->bv_page);
 
-		memcpy(dst_p + dst_bv->bv_offset,
-		       src_p + src_bv->bv_offset,
+		memcpy(dst_p + dst_offset,
+		       src_p + src_offset,
 		       bytes);
 
 		kunmap_atomic(dst_p);

             reply	other threads:[~2013-09-20  2:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20  2:35 Kent Overstreet [this message]
2013-09-20  7:06 ` Data corruption with bcache in 3.11 Rolf Fokkens
     [not found]   ` <523BF3EB.7050709-6w2rdlBuEQTpMFipWq+H6g@public.gmane.org>
2013-09-20  7:44     ` Kent Overstreet
     [not found]       ` <CALJ65zkj2U-Kr_EBx7RJETqW2jQmWxsr0QmZspHU3H+jDts3tQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-20 19:33         ` Rolf Fokkens
     [not found]           ` <523CA2FF.4090102-6w2rdlBuEQTpMFipWq+H6g@public.gmane.org>
2013-09-20 20:45             ` Zachary Palmer
  -- strict thread matches above, loose matches on Subject: below --
2013-09-29 16:52 Joseph Yasi

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=20130920023501.GJ17891@kmo-pixel \
    --to=kent.overstreet-re5jqeeqqe8avxtiumwx3w@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox