afs: fix the usage of read_seqbegin_or_lock() in afs_lookup_volume_rcu()
authorOleg Nesterov <oleg@redhat.com>
Thu, 30 Nov 2023 11:56:06 +0000 (12:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Feb 2024 20:14:16 +0000 (20:14 +0000)
commit8d742c4a8b2b8d1f59954be8adcb78017f93926f
tree502632413f12d55eca5d3a0a5df928904154deda
parent464a0ca0f05a74ae3cbc6eb712abe51cf188f486
afs: fix the usage of read_seqbegin_or_lock() in afs_lookup_volume_rcu()

[ Upstream commit 4121b4337146b64560d1e46ebec77196d9287802 ]

David Howells says:

 (2) afs_lookup_volume_rcu().

     There can be a lot of volumes known by a system.  A thousand would
     require a 10-step walk and this is drivable by remote operation, so I
     think this should probably take a lock on the second pass too.

Make the "seq" counter odd on the 2nd pass, otherwise read_seqbegin_or_lock()
never takes the lock.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Link: https://lore.kernel.org/r/20231130115606.GA21571@redhat.com/
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/afs/callback.c