stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] dm-integrity: change the variable suspending from bool to int
@ 2018-06-06 15:33 Mikulas Patocka
  0 siblings, 0 replies; 2+ messages in thread
From: Mikulas Patocka @ 2018-06-06 15:33 UTC (permalink / raw)
  To: Mike Snitzer, Milan Broz; +Cc: dm-devel, Mikulas Patocka, stable

[-- Attachment #1: dm-integrity-suspending.patch --]
[-- Type: text/plain, Size: 1348 bytes --]

The 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".

This patch changes suspending to an int.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org

---
 drivers/md/dm-integrity.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6/drivers/md/dm-integrity.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-integrity.c	2018-05-01 00:23:32.000000000 +0200
+++ linux-2.6/drivers/md/dm-integrity.c	2018-05-01 00:38:57.000000000 +0200
@@ -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(str
 
 	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(str
 		dm_integrity_flush_buffers(ic);
 	}
 
-	ic->suspending = false;
+	WRITE_ONCE(ic->suspending, 0);
 
 	BUG_ON(!RB_EMPTY_ROOT(&ic->in_progress));
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/9] dm-integrity: change the variable suspending from bool to int
@ 2018-07-03 18:13 Mikulas Patocka
  0 siblings, 0 replies; 2+ messages in thread
From: Mikulas Patocka @ 2018-07-03 18:13 UTC (permalink / raw)
  To: Milan Broz, Mike Snitzer; +Cc: dm-devel, Mikulas Patocka, stable

[-- Attachment #1: dm-integrity-suspending.patch --]
[-- Type: text/plain, Size: 1348 bytes --]

The 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".

This patch changes suspending to an int.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org

---
 drivers/md/dm-integrity.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6/drivers/md/dm-integrity.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-integrity.c	2018-06-29 23:13:54.990000000 +0200
+++ linux-2.6/drivers/md/dm-integrity.c	2018-06-29 23:13:54.980000000 +0200
@@ -178,7 +178,7 @@ struct dm_integrity_c {
 	__u8 sectors_per_block;
 
 	unsigned char mode;
-	bool suspending;
+	int suspending;
 
 	int failed;
 
@@ -2214,7 +2214,7 @@ static void dm_integrity_postsuspend(str
 
 	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);
@@ -2224,7 +2224,7 @@ static void dm_integrity_postsuspend(str
 		dm_integrity_flush_buffers(ic);
 	}
 
-	ic->suspending = false;
+	WRITE_ONCE(ic->suspending, 0);
 
 	BUG_ON(!RB_EMPTY_ROOT(&ic->in_progress));
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-03 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-06 15:33 [PATCH 1/9] dm-integrity: change the variable suspending from bool to int Mikulas Patocka
  -- strict thread matches above, loose matches on Subject: below --
2018-07-03 18:13 Mikulas Patocka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).