[PATCH] afs: Add barriers by using clear_and_wake_up_bit()
Arnaud Bonnet
abo at medichon.fr
Wed Jul 8 02:34:36 PDT 2026
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 <abo at medichon.fr>
---
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(-)
diff --git a/fs/afs/server.c b/fs/afs/server.c
index 0fe162ea2a36..8cbe0f7425a4 100644
--- a/fs/afs/server.c
+++ b/fs/afs/server.c
@@ -605,8 +605,7 @@ bool afs_check_server_record(struct afs_operation *op, struct afs_server *server
if (!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;
}
diff --git a/fs/afs/vl_probe.c b/fs/afs/vl_probe.c
index 3d2e0c925460..9850e028c44b 100644
--- a/fs/afs/vl_probe.c
+++ b/fs/afs/vl_probe.c
@@ -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);
}
/*
--
2.53.0
More information about the linux-afs
mailing list