afs: Add barriers by using clear_and_wake_up_bit()
PATCH 1/1 afs: Add barriers by using clear_and_wake_up_bit()
Insert the required barrier between clear_bit_unlock() and wake_up_bit() as per the wake_up_bit() documentation:
* In order for this to function properly there must be a full memory
* barrier after the bit is cleared and before this function is called.
Use the clear_and_wake_up_bit() helper which is a wrapper for the common clear_bit_unlock() -> smp_mb__after_atomic() -> wake_up_bit() sequence.
Fixes 3bf0fb6f33dd5 ("afs: Probe multiple fileservers simultaneously")
Fixes d2ddc776a4581 ("afs: Overhaul volume and server record caching and fileserver rotation")
Signed-off-by Arnaud Bonnet <[email protected]>
---
Note on testing: although the change builds and feels rather uncontroversial, I couldn't get the changed code paths to trigger on my setup when loading the module and could use assistance with this.
fs/afs/server.c | 3 +-- fs/afs/vl_probe.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
fs/afs/server.c +1 -2
@@ -605,8 +605,7 @@ bool afs_check_server_record(struct afs_operation *op, struct afs_server *serverif (!test_and_set_bit_lock (AFS_SERVER_FL_UPDATING , &server->flags)) {clear_bit (AFS_SERVER_FL_NEEDS_UPDATE , &server->flags); success =afs_update_server_record (op, server, key); -clear_bit_unlock (AFS_SERVER_FL_UPDATING , &server->flags); -wake_up_bit (&server->flags,AFS_SERVER_FL_UPDATING ); +clear_and_wake_up_bit (AFS_SERVER_FL_UPDATING , &server->flags);_leave (" = %d" , success);return success; }
fs/afs/vl_probe.c +1 -2
@@ -22,8 +22,7 @@ static void afs_finished_vl_probe(struct afs_vlserver *server)clear_bit (AFS_VLSERVER_FL_RESPONDING , &server->flags); } -clear_bit_unlock (AFS_VLSERVER_FL_PROBING , &server->flags); -wake_up_bit (&server->flags,AFS_VLSERVER_FL_PROBING ); +clear_and_wake_up_bit (AFS_VLSERVER_FL_PROBING , &server->flags); }/*
Signature · 1 line
2.53.0