[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.10 / 0086-dm-flakey-fix-crash-on-read-when-corrupt_bio_byte-no.patch
1 From 91d95657633fa1d1bd641323977bc4639d39599d Mon Sep 17 00:00:00 2001
2 From: Mike Snitzer <snitzer@redhat.com>
3 Date: Wed, 7 Mar 2012 19:09:39 +0000
4 Subject: [PATCH 86/95] dm flakey: fix crash on read when corrupt_bio_byte not
5 set
7 commit 1212268fd9816e3b8801e57b896fceaec71969ad upstream.
9 The following BUG is hit on the first read that is submitted to a dm
10 flakey test device while the device is "down" if the corrupt_bio_byte
11 feature wasn't requested when the device's table was loaded.
13 Example DM table that will hit this BUG:
14 0 2097152 flakey 8:0 2048 0 30
16 This bug was introduced by commit a3998799fb4df0b0af8271a7d50c4269032397aa
17 (dm flakey: add corrupt_bio_byte feature) in v3.1-rc1.
19 BUG: unable to handle kernel paging request at ffff8801cfce3fff
20 IP: [<ffffffffa008c233>] corrupt_bio_data+0x6e/0xae [dm_flakey]
21 PGD 1606063 PUD 0
22 Oops: 0002 [#1] SMP
23 ...
24 Call Trace:
25 <IRQ>
26 [<ffffffffa008c2b5>] flakey_end_io+0x42/0x48 [dm_flakey]
27 [<ffffffffa00dca98>] clone_endio+0x54/0xb6 [dm_mod]
28 [<ffffffff81130587>] bio_endio+0x2d/0x2f
29 [<ffffffff811c819a>] req_bio_endio+0x96/0x9f
30 [<ffffffff811c94b9>] blk_update_request+0x1dc/0x3a9
31 [<ffffffff812f5ee2>] ? rcu_read_unlock+0x21/0x23
32 [<ffffffff811c96a6>] blk_update_bidi_request+0x20/0x6e
33 [<ffffffff811c9713>] blk_end_bidi_request+0x1f/0x5d
34 [<ffffffff811c978d>] blk_end_request+0x10/0x12
35 [<ffffffff8128f450>] scsi_io_completion+0x1e5/0x4b1
36 [<ffffffff812882a9>] scsi_finish_command+0xec/0xf5
37 [<ffffffff8128f830>] scsi_softirq_done+0xff/0x108
38 [<ffffffff811ce284>] blk_done_softirq+0x84/0x98
39 [<ffffffff81048d19>] __do_softirq+0xe3/0x1d5
40 [<ffffffff8138f83f>] ? _raw_spin_lock+0x62/0x69
41 [<ffffffff810997cf>] ? handle_irq_event+0x4c/0x61
42 [<ffffffff8139833c>] call_softirq+0x1c/0x30
43 [<ffffffff81003b37>] do_softirq+0x4b/0xa3
44 [<ffffffff81048a39>] irq_exit+0x53/0xca
45 [<ffffffff81398acd>] do_IRQ+0x9d/0xb4
46 [<ffffffff81390333>] common_interrupt+0x73/0x73
47 ...
49 Signed-off-by: Mike Snitzer <snitzer@redhat.com>
50 Signed-off-by: Alasdair G Kergon <agk@redhat.com>
51 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
52 ---
53 drivers/md/dm-flakey.c | 2 +-
54 1 file changed, 1 insertion(+), 1 deletion(-)
56 diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c
57 index 9fb18c1..b280c43 100644
58 --- a/drivers/md/dm-flakey.c
59 +++ b/drivers/md/dm-flakey.c
60 @@ -323,7 +323,7 @@ static int flakey_end_io(struct dm_target *ti, struct bio *bio,
61 * Corrupt successful READs while in down state.
62 * If flags were specified, only corrupt those that match.
63 */
64 - if (!error && bio_submitted_while_down &&
65 + if (fc->corrupt_bio_byte && !error && bio_submitted_while_down &&
66 (bio_data_dir(bio) == READ) && (fc->corrupt_bio_rw == READ) &&
67 all_corrupt_bio_flags_match(bio, fc))
68 corrupt_bio_data(bio, fc);
69 --
70 1.7.9.4