Received: from 5.mo560.mail-out.ovh.net (5.mo560.mail-out.ovh.net [87.98.181.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D22B3822A8 for ; Wed, 8 Jul 2026 10:13:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=87.98.181.248 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783505623; cv=none; b=a/OybCnsBrkFOu5+ADeaX0epr+HD1zYYQwpHjEWZpKwz0C5pmSvLaJS2P01WnDxbM1qG2APeva7f0dEcYvsxpivVN9E7O7wsouE52NAyw73KG5H/D1jyUj4hZHzs3mL85z0GWIINm45yowumbMLVbojx9H33Rgkghfr4e6oMJU4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783505623; c=relaxed/simple; bh=9KoXhhPhKDJUIj8fvU4SRbfiwScIkPY8qgH9hbtw8xA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ZgD1FPrgBeIOhVP2VpkW4MACft9KXnmj2TvTtCYAVDJSvhDeAHDdzVLrEXxMULBVoaR7vy6cMXvBLz0VB37yR2MyY0qKYIuJieNlAPmFc50TeKHPS9FtrkGaz+PoUTHyPv3ffwzTJYqZ4wT0Ro4YGTq11f6pqHwX2DZ2GM552is= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=medichon.fr; spf=pass smtp.mailfrom=medichon.fr; dkim=pass (2048-bit key) header.d=medichon.fr header.i=@medichon.fr header.b=PQGZj2mX; arc=none smtp.client-ip=87.98.181.248 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=medichon.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=medichon.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=medichon.fr header.i=@medichon.fr header.b="PQGZj2mX" Received: from director5.ghost.mail-out.ovh.net (unknown [10.110.37.219]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id 4gwCcQ50DbzBC4w for ; Wed, 8 Jul 2026 09:35:02 +0000 (UTC) Received: from ghost-submission-7d8d68f679-6ll7s (unknown [10.110.164.123]) by director5.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 57C4C100109; Wed, 8 Jul 2026 09:35:01 +0000 (UTC) Received: from medichon.fr ([37.59.142.114]) by ghost-submission-7d8d68f679-6ll7s with ESMTPSA id 3QCZBsUZTmqDDggAdqIkmg (envelope-from ); Wed, 08 Jul 2026 09:35:01 +0000 Authentication-Results:garm.ovh; auth=pass (GARM-114S008341e7cee-a557-473d-a6cb-f7199088f4d4, 03DE1CAB725B8D9AAD6D7D9F122FE18D35C46272) smtp.auth=abo@medichon.fr X-OVh-ClientIp:88.190.90.129 From: Arnaud Bonnet To: dhowells@redhat.com, marc.dionne@auristor.com Cc: linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, skhan@linuxfoundation.org, jkoolstra@xs4all.nl, me@brighamcampbell.com, Arnaud Bonnet Subject: [PATCH] afs: Add barriers by using clear_and_wake_up_bit() Date: Wed, 8 Jul 2026 11:34:36 +0200 Message-ID: <20260708093436.6278-1-abo@medichon.fr> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit x-ovh-tracer-id: 1857171899691458142 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: dmFkZTEj9h7hUUnWfL8l2PKpqGL8HIL0WT5wSfapyPNwT/lwsJC8s9yQWn9GdQ8ScB9Gh4kGzBq7njkvaLTiRJAtk7Zm1iIlrbq/WrDYXM2mxmOVJ4CGlkG2lmrfm8bAVnby4uY+FYGApw5EW+K3aizfrLIc6r5+4sQ0/wyhiHd126Zn6UlilhP27jNURBbDSCK/B5RsYU1JlA3wUPyHz1NmtmytIyUZ7GolDMaIPjjJctLtTS6HY8yynWofr8fzloiyjDkhCXAO5KSD0vSQa08Qjn+n6tv8hosJRuQR/kDBNUcajADfK/6vPbFv9GCJUsk1aoYJA3H+JyP1chIhuKUEg70GGTAEE4sF91z7yaPzkALFQoMDq0vTuY8ET2fMMq8J7ozdZ2IvGOubq6fiJ1ZiB+i3jXoZQhqe+MkezT8Xho/+NIjR4lOTOntRJBZAmBJzxtW8GnI6RJS8aGB+qIHuj77Jw0+qPSwBjZjPzy3NDtkaKzM8rFdzTDM+E6zKSvqNFHIt2/SiT57sg2scJUoBNp8em7Rky3pbxJT/qlssYbWr3lZQHpUuJ+AzZTKSCygPIEvW5fZLgMGs8xROE3gpnO8vzHPYHPuNSv2egcjzODDlMEiFQucfhYr7RxrEpOXJz6cUtLtNGvMI0+IXgbuDDdD9WgzLxGNdrUt02NQdiwZDFA DKIM-Signature: a=rsa-sha256; bh=cXA+K3DzxXybmsbb+FSczPpe/tEifs7cVG+TQzMiyLg=; c=relaxed/relaxed; d=medichon.fr; h=From; s=ovhmo3801317-selector1; t=1783503303; v=1; b=PQGZj2mXLxs9tUYMwnpMiU9Lm0gVOEq4w5xM6c+UHQ4teOtyDftm0IfXpZxaDdhZd73DGVDf osFGm5nTsqwS3WHegc4LiCFCbgUY0UCvyN6azhmqf9FrbJH9Ry3KJZwXBPJwKFoIg2YywlGUc3C 0qEavOV5ugyrcLO9Z5OFlbmCg6fh0OZa8pL4pAsZm/4/zABtbkvhon/FyWy6RXIaoKJtODWtq6w 4kofQFvmdlR0JbqzMxNPdSrlE1iITSYqbH8ntTnPyxGuPXS5WSmjtaGxJTgS7coBRMaN+awJkGc dgyniMyvpEV0DWUQN19FtHbzl2/qdwpreudP1phdLbhTg== 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 --- 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