diff options
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0065-md-raid1-close-some-possible-races-on-write-errors-d.patch')
-rw-r--r-- | recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0065-md-raid1-close-some-possible-races-on-write-errors-d.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0065-md-raid1-close-some-possible-races-on-write-errors-d.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0065-md-raid1-close-some-possible-races-on-write-errors-d.patch new file mode 100644 index 00000000..b3bd32c3 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0065-md-raid1-close-some-possible-races-on-write-errors-d.patch | |||
@@ -0,0 +1,58 @@ | |||
1 | From a5f676adf9ef247dd5363de5f0e26d0bdb6597bc Mon Sep 17 00:00:00 2001 | ||
2 | From: NeilBrown <neilb@suse.de> | ||
3 | Date: Thu, 19 Jul 2012 15:59:18 +1000 | ||
4 | Subject: [PATCH 065/109] md/raid1: close some possible races on write errors | ||
5 | during resync | ||
6 | |||
7 | commit 58e94ae18478c08229626daece2fc108a4a23261 upstream. | ||
8 | |||
9 | commit 4367af556133723d0f443e14ca8170d9447317cb | ||
10 | md/raid1: clear bad-block record when write succeeds. | ||
11 | |||
12 | Added a 'reschedule_retry' call possibility at the end of | ||
13 | end_sync_write, but didn't add matching code at the end of | ||
14 | sync_request_write. So if the writes complete very quickly, or | ||
15 | scheduling makes it seem that way, then we can miss rescheduling | ||
16 | the request and the resync could hang. | ||
17 | |||
18 | Also commit 73d5c38a9536142e062c35997b044e89166e063b | ||
19 | md: avoid races when stopping resync. | ||
20 | |||
21 | Fix a race condition in this same code in end_sync_write but didn't | ||
22 | make the change in sync_request_write. | ||
23 | |||
24 | This patch updates sync_request_write to fix both of those. | ||
25 | Patch is suitable for 3.1 and later kernels. | ||
26 | |||
27 | Reported-by: Alexander Lyakas <alex.bolshoy@gmail.com> | ||
28 | Original-version-by: Alexander Lyakas <alex.bolshoy@gmail.com> | ||
29 | Signed-off-by: NeilBrown <neilb@suse.de> | ||
30 | Signed-off-by: Ben Hutchings <ben@decadent.org.uk> | ||
31 | --- | ||
32 | drivers/md/raid1.c | 10 ++++++++-- | ||
33 | 1 files changed, 8 insertions(+), 2 deletions(-) | ||
34 | |||
35 | diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c | ||
36 | index 58f0055..2d97bf0 100644 | ||
37 | --- a/drivers/md/raid1.c | ||
38 | +++ b/drivers/md/raid1.c | ||
39 | @@ -1713,8 +1713,14 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio) | ||
40 | |||
41 | if (atomic_dec_and_test(&r1_bio->remaining)) { | ||
42 | /* if we're here, all write(s) have completed, so clean up */ | ||
43 | - md_done_sync(mddev, r1_bio->sectors, 1); | ||
44 | - put_buf(r1_bio); | ||
45 | + int s = r1_bio->sectors; | ||
46 | + if (test_bit(R1BIO_MadeGood, &r1_bio->state) || | ||
47 | + test_bit(R1BIO_WriteError, &r1_bio->state)) | ||
48 | + reschedule_retry(r1_bio); | ||
49 | + else { | ||
50 | + put_buf(r1_bio); | ||
51 | + md_done_sync(mddev, s, 1); | ||
52 | + } | ||
53 | } | ||
54 | } | ||
55 | |||
56 | -- | ||
57 | 1.7.7.6 | ||
58 | |||