summaryrefslogtreecommitdiffstats
path: root/fs/afs/callback.c
diff options
context:
space:
mode:
authorDavid Howells2019-05-11 00:03:31 +0200
committerDavid Howells2019-05-16 17:25:21 +0200
commitc7226e407b6065d3bda8bd9dc627663d2c505ea3 (patch)
treeffdfd1eb1aa6c2096f4bc371b3347b57427665b9 /fs/afs/callback.c
parentafs: Don't invalidate callback if AFS_VNODE_DIR_VALID not set (diff)
downloadkernel-qcow2-linux-c7226e407b6065d3bda8bd9dc627663d2c505ea3.tar.gz
kernel-qcow2-linux-c7226e407b6065d3bda8bd9dc627663d2c505ea3.tar.xz
kernel-qcow2-linux-c7226e407b6065d3bda8bd9dc627663d2c505ea3.zip
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 <dhowells@redhat.com>
Diffstat (limited to 'fs/afs/callback.c')
-rw-r--r--fs/afs/callback.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/fs/afs/callback.c b/fs/afs/callback.c
index 128f2dbe256a..4876079aa643 100644
--- a/fs/afs/callback.c
+++ b/fs/afs/callback.c
@@ -218,14 +218,8 @@ void __afs_break_callback(struct afs_vnode *vnode)
vnode->cb_break++;
afs_clear_permits(vnode);
- spin_lock(&vnode->lock);
-
- _debug("break callback");
-
- if (list_empty(&vnode->granted_locks) &&
- !list_empty(&vnode->pending_locks))
+ if (vnode->lock_state == AFS_VNODE_LOCK_WAITING_FOR_CB)
afs_lock_may_be_available(vnode);
- spin_unlock(&vnode->lock);
}
}