Skip to content

Commit

Permalink
dm integrity: change 'suspending' variable from bool to int
Browse files Browse the repository at this point in the history
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: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
  • Loading branch information
Mikulas Patocka authored and Mike Snitzer committed Jul 27, 2018
1 parent cda6b5a commit c21b163
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/md/dm-integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ struct dm_integrity_c {
__u8 sectors_per_block;

unsigned char mode;
bool suspending;
int suspending;

int failed;

Expand Down Expand Up @@ -2210,7 +2210,7 @@ static void dm_integrity_postsuspend(struct dm_target *ti)

del_timer_sync(&ic->autocommit_timer);

ic->suspending = true;
WRITE_ONCE(ic->suspending, 1);

queue_work(ic->commit_wq, &ic->commit_work);
drain_workqueue(ic->commit_wq);
Expand All @@ -2220,7 +2220,7 @@ static void dm_integrity_postsuspend(struct dm_target *ti)
dm_integrity_flush_buffers(ic);
}

ic->suspending = false;
WRITE_ONCE(ic->suspending, 0);

BUG_ON(!RB_EMPTY_ROOT(&ic->in_progress));

Expand Down

0 comments on commit c21b163

Please sign in to comment.