]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
dm integrity: change 'suspending' variable from bool to int
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 3 Jul 2018 18:13:25 +0000 (20:13 +0200)
committerMike Snitzer <snitzer@redhat.com>
Fri, 27 Jul 2018 19:24:20 +0000 (15:24 -0400)
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>
drivers/md/dm-integrity.c

index 86438b2f10dd0a92b0e4fbd46eba6e04fff478e6..0a8a4c2aa3ea525fe8ef8123f2268c8d6e5517c6 100644 (file)
@@ -178,7 +178,7 @@ struct dm_integrity_c {
        __u8 sectors_per_block;
 
        unsigned char mode;
-       bool suspending;
+       int suspending;
 
        int failed;
 
@@ -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);
@@ -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));