From: Calvin Owens <jcalvinowens@gmail.com>
To: Kent Overstreet <koverstreet@google.com>,
linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>, NeilBrown <neilb@suse.de>
Subject: [PATCH] md: Partially revert 2f6db2a7, which broke raid5
Date: Fri, 17 May 2013 16:32:23 -0500 [thread overview]
Message-ID: <20130517213223.GA2530@gmail.com> (raw)
Commit 2f6db2a7 was part of a series that cleaned up mdraid code by
replacing explicit re-initialization of struct bio with bio_reset().
In raid5 it incorrectly assumed that a couple initializations of its
members was a full reset, erasing the existing data and unconditionally
triggering the following BUG when assembling arrays:
[ 14.653072] kernel BUG at /home/calvinow/git/linux/drivers/scsi/scsi_lib.c:1196!
[ 14.653074] invalid opcode: 0000 [#1] PREEMPT SMP
[ 14.653076] CPU: 1 PID: 40 Comm: kworker/1:0H Not tainted 3.10.0-rc1-amd-00279-g8f710dd #3
[ 14.653077] Hardware name: System manufacturer System Product Name/M5A88-M, BIOS 0601 09/20/2011
[ 14.653082] Workqueue: kblockd blk_delay_work
<snip>
[ 14.653123] Call Trace:
[ 14.653126] [<ffffffff81477248>] sd_prep_fn+0x2c8/0xb70
[ 14.653129] [<ffffffff812c8b70>] ? deadline_remove_request.isra.9+0x50/0x90
[ 14.653132] [<ffffffff812b8f5b>] blk_peek_request+0xdb/0x210
[ 14.653134] [<ffffffff81465f15>] scsi_request_fn+0x45/0x4e0
[ 14.653136] [<ffffffff812b6a51>] __blk_run_queue+0x31/0x40
[ 14.653138] [<ffffffff812b6a84>] blk_delay_work+0x24/0x40
[ 14.653141] [<ffffffff8105dc2a>] process_one_work+0x1da/0x490
[ 14.653143] [<ffffffff8105dbcd>] ? process_one_work+0x17d/0x490
[ 14.653145] [<ffffffff8105e32a>] worker_thread+0x11a/0x370
[ 14.653147] [<ffffffff8105e210>] ? rescuer_thread+0x2f0/0x2f0
[ 14.653149] [<ffffffff81066296>] kthread+0xd6/0xe0
[ 14.653151] [<ffffffff810661c0>] ? __kthread_unpark+0x50/0x50
[ 14.653154] [<ffffffff816e4d6c>] ret_from_fork+0x7c/0xb0
[ 14.653156] [<ffffffff810661c0>] ? __kthread_unpark+0x50/0x50
[ 14.653172] Code: <snip>
[ 14.653174] RIP [<ffffffff81467329>] scsi_setup_fs_cmnd+0x89/0x90
Signed-off-by: Calvin Owens <jcalvinowens@gmail.com>
---
drivers/md/raid5.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 9359828..97be03f 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -643,7 +643,6 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
set_bit(STRIPE_IO_STARTED, &sh->state);
- bio_reset(bi);
bi->bi_bdev = rdev->bdev;
bi->bi_rw = rw;
bi->bi_end_io = (rw & WRITE)
@@ -664,9 +663,12 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags))
bi->bi_rw |= REQ_FLUSH;
+ bi->bi_flags = 1 << BIO_UPTODATE;
+ bi->bi_idx = 0;
bi->bi_io_vec[0].bv_len = STRIPE_SIZE;
bi->bi_io_vec[0].bv_offset = 0;
bi->bi_size = STRIPE_SIZE;
+ bi->bi_next = NULL;
if (rrdev)
set_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags);
@@ -683,7 +685,6 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
set_bit(STRIPE_IO_STARTED, &sh->state);
- bio_reset(rbi);
rbi->bi_bdev = rrdev->bdev;
rbi->bi_rw = rw;
BUG_ON(!(rw & WRITE));
--
1.8.2.1
next reply other threads:[~2013-05-17 21:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-17 21:32 Calvin Owens [this message]
2013-05-18 7:05 ` [PATCH] md: Partially revert 2f6db2a7, which broke raid5 Jens Axboe
2013-05-19 17:51 ` Kent Overstreet
2013-05-28 16:03 ` Ilia Mirkin
2013-05-29 12:43 ` Richard W.M. Jones
2013-05-29 13:03 ` Jens Axboe
2013-05-29 23:22 ` NeilBrown
2013-05-30 6:42 ` Jens Axboe
2013-05-30 7:31 ` Richard W.M. Jones
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=20130517213223.GA2530@gmail.com \
--to=jcalvinowens@gmail.com \
--cc=axboe@kernel.dk \
--cc=koverstreet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/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).