]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
afs: Fix lock-wait/callback-break double locking
authorDavid Howells <dhowells@redhat.com>
Fri, 10 May 2019 22:03:31 +0000 (23:03 +0100)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
commitcbd85d27529cf89ed88bc44160821eddc44e0730
tree64b3e6b6f1b1888eff8dbc1bd4411090c4871509
parent3cf7d92e2b97ae687f715bc0834fb528b5af6fe5
afs: Fix lock-wait/callback-break double locking

BugLink: https://bugs.launchpad.net/bugs/1863019
[ 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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/afs/callback.c
fs/afs/flock.c