Commit c21b1639 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Mike Snitzer

dm integrity: change 'suspending' variable from bool to int

Early alpha processors can't write a byte or short atomically - they
read 8 bytes, modify the byte or two bytes in registers and write back
8 bytes.

The modification of the variable "suspending" may race with
modification of the variable "failed".  Fix this by changing
"suspending" to an int.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent cda6b5ab
...@@ -178,7 +178,7 @@ struct dm_integrity_c { ...@@ -178,7 +178,7 @@ struct dm_integrity_c {
__u8 sectors_per_block; __u8 sectors_per_block;
unsigned char mode; unsigned char mode;
bool suspending; int suspending;
int failed; int failed;
...@@ -2210,7 +2210,7 @@ static void dm_integrity_postsuspend(struct dm_target *ti) ...@@ -2210,7 +2210,7 @@ static void dm_integrity_postsuspend(struct dm_target *ti)
del_timer_sync(&ic->autocommit_timer); del_timer_sync(&ic->autocommit_timer);
ic->suspending = true; WRITE_ONCE(ic->suspending, 1);
queue_work(ic->commit_wq, &ic->commit_work); queue_work(ic->commit_wq, &ic->commit_work);
drain_workqueue(ic->commit_wq); drain_workqueue(ic->commit_wq);
...@@ -2220,7 +2220,7 @@ static void dm_integrity_postsuspend(struct dm_target *ti) ...@@ -2220,7 +2220,7 @@ static void dm_integrity_postsuspend(struct dm_target *ti)
dm_integrity_flush_buffers(ic); dm_integrity_flush_buffers(ic);
} }
ic->suspending = false; WRITE_ONCE(ic->suspending, 0);
BUG_ON(!RB_EMPTY_ROOT(&ic->in_progress)); BUG_ON(!RB_EMPTY_ROOT(&ic->in_progress));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment