]>
Commit | Line | Data |
---|---|---|
bed0f502 GKH |
1 | From c21b16392701543d61e366dca84e15fe7f0cf0cf Mon Sep 17 00:00:00 2001 |
2 | From: Mikulas Patocka <mpatocka@redhat.com> | |
3 | Date: Tue, 3 Jul 2018 20:13:25 +0200 | |
4 | Subject: dm integrity: change 'suspending' variable from bool to int | |
5 | ||
6 | From: Mikulas Patocka <mpatocka@redhat.com> | |
7 | ||
8 | commit c21b16392701543d61e366dca84e15fe7f0cf0cf upstream. | |
9 | ||
10 | Early alpha processors can't write a byte or short atomically - they | |
11 | read 8 bytes, modify the byte or two bytes in registers and write back | |
12 | 8 bytes. | |
13 | ||
14 | The modification of the variable "suspending" may race with | |
15 | modification of the variable "failed". Fix this by changing | |
16 | "suspending" to an int. | |
17 | ||
18 | Cc: stable@vger.kernel.org | |
19 | Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> | |
20 | Signed-off-by: Mike Snitzer <snitzer@redhat.com> | |
21 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
22 | ||
23 | --- | |
24 | drivers/md/dm-integrity.c | 6 +++--- | |
25 | 1 file changed, 3 insertions(+), 3 deletions(-) | |
26 | ||
27 | --- a/drivers/md/dm-integrity.c | |
28 | +++ b/drivers/md/dm-integrity.c | |
29 | @@ -177,7 +177,7 @@ struct dm_integrity_c { | |
30 | __u8 sectors_per_block; | |
31 | ||
32 | unsigned char mode; | |
33 | - bool suspending; | |
34 | + int suspending; | |
35 | ||
36 | int failed; | |
37 | ||
38 | @@ -2209,7 +2209,7 @@ static void dm_integrity_postsuspend(str | |
39 | ||
40 | del_timer_sync(&ic->autocommit_timer); | |
41 | ||
42 | - ic->suspending = true; | |
43 | + WRITE_ONCE(ic->suspending, 1); | |
44 | ||
45 | queue_work(ic->commit_wq, &ic->commit_work); | |
46 | drain_workqueue(ic->commit_wq); | |
47 | @@ -2219,7 +2219,7 @@ static void dm_integrity_postsuspend(str | |
48 | dm_integrity_flush_buffers(ic); | |
49 | } | |
50 | ||
51 | - ic->suspending = false; | |
52 | + WRITE_ONCE(ic->suspending, 0); | |
53 | ||
54 | BUG_ON(!RB_EMPTY_ROOT(&ic->in_progress)); | |
55 |