public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] afs: Add missing memory barriers in afs_manage_cell()
@ 2018-11-26 16:44 Andrea Parri
  2019-01-17 15:31 ` Andrea Parri
  0 siblings, 1 reply; 3+ messages in thread
From: Andrea Parri @ 2018-11-26 16:44 UTC (permalink / raw)
  To: David Howells; +Cc: linux-afs, linux-kernel, Andrea Parri

As the comments for wake_up_bit() and waitqueue_active() point out,
the barriers are needed to order the clearing of the _FL_NOT_READY
bit and the waitqueue_active() load; match the implicit barrier in
prepare_to_wait().

Signed-off-by: Andrea Parri <andrea.parri@amarulasolutions.com>
---
 fs/afs/cell.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index cf445dbd5f2e0..a9488abe56029 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -637,6 +637,7 @@ static void afs_manage_cell(struct work_struct *work)
 		cell->state = AFS_CELL_ACTIVE;
 		smp_wmb();
 		clear_bit(AFS_CELL_FL_NOT_READY, &cell->flags);
+		smp_mb__after_atomic(); /* see comment for wake_up_bit() */
 		wake_up_bit(&cell->flags, AFS_CELL_FL_NOT_READY);
 		goto again;
 
@@ -678,6 +679,7 @@ static void afs_manage_cell(struct work_struct *work)
 	cell->state = AFS_CELL_ACTIVE;
 	smp_wmb();
 	clear_bit(AFS_CELL_FL_NOT_READY, &cell->flags);
+	smp_mb__after_atomic(); /* see comment for wake_up_bit() */
 	wake_up_bit(&cell->flags, AFS_CELL_FL_NOT_READY);
 	_leave(" [deact->act]");
 	return;
-- 
2.17.1


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

end of thread, other threads:[~2019-01-31 18:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-26 16:44 [PATCH] afs: Add missing memory barriers in afs_manage_cell() Andrea Parri
2019-01-17 15:31 ` Andrea Parri
2019-01-31 18:23   ` Andrea Parri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox