From c7226e407b6065d3bda8bd9dc627663d2c505ea3 Mon Sep 17 00:00:00 2001 From: David Howells Date: Fri, 10 May 2019 23:03:31 +0100 Subject: afs: Fix lock-wait/callback-break double locking __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 --- fs/afs/flock.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'fs/afs/flock.c') diff --git a/fs/afs/flock.c b/fs/afs/flock.c index 3501ef7ddbb4..c91cd201013f 100644 --- a/fs/afs/flock.c +++ b/fs/afs/flock.c @@ -41,9 +41,6 @@ void afs_lock_may_be_available(struct afs_vnode *vnode) { _enter("{%llx:%llu}", 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); -- cgit v1.2.3