summaryrefslogtreecommitdiffstats
path: root/fs/afs/flock.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2019-05-10 23:03:31 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-27 14:50:49 +0100
commit98f5ce7e313e6475a2a32c93728084fe089c6364 (patch)
treef4ba012026f6d6040f8f798ea9ed2bad1252f0cb /fs/afs/flock.c
parent2fd90073c88ddffd603ab2d4c952c2f8a11ea041 (diff)
downloadlinux-stable-98f5ce7e313e6475a2a32c93728084fe089c6364.tar.gz
linux-stable-98f5ce7e313e6475a2a32c93728084fe089c6364.tar.bz2
linux-stable-98f5ce7e313e6475a2a32c93728084fe089c6364.zip
afs: Fix lock-wait/callback-break double locking
[ Upstream commit c7226e407b6065d3bda8bd9dc627663d2c505ea3 ] __afs_break_callback() holds vnode->lock around its call of afs_lock_may_be_available() - which also takes that lock. Fix this by not taking the lock in __afs_break_callback(). Also, there's no point checking the granted_locks and pending_locks queues; it's sufficient to check lock_state, so move that check out of afs_lock_may_be_available() into __afs_break_callback() to replace the queue checks. Fixes: e8d6c554126b ("AFS: implement file locking") Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/afs/flock.c')
-rw-r--r--fs/afs/flock.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/fs/afs/flock.c b/fs/afs/flock.c
index aea7224ba198..fbf4986b1224 100644
--- a/fs/afs/flock.c
+++ b/fs/afs/flock.c
@@ -39,9 +39,6 @@ void afs_lock_may_be_available(struct afs_vnode *vnode)
{
_enter("{%x:%u}", vnode->fid.vid, vnode->fid.vnode);
- if (vnode->lock_state != AFS_VNODE_LOCK_WAITING_FOR_CB)
- return;
-
spin_lock(&vnode->lock);
if (vnode->lock_state == AFS_VNODE_LOCK_WAITING_FOR_CB)
afs_next_locker(vnode, 0);