Skip to content

Commit f456458

Browse files
jtlaytonJ. Bruce Fields
authored andcommitted
nfsd: wake blocked file lock waiters before sending callback
When a blocked NFS lock is "awoken" we send a callback to the server and then wake any hosts waiting on it. If a client attempts to get a lock and then drops off the net, we could end up waiting for a long time until we end up waking locks blocked on that request. So, wake any other waiting lock requests before sending the callback. Do this by calling locks_delete_block in a new "prepare" phase for CB_NOTIFY_LOCK callbacks. URL: https://bugzilla.kernel.org/show_bug.cgi?id=203363 Fixes: 16306a6 ("fs/locks: always delete_block after waiting.") Reported-by: Slawomir Pryczek <slawek1211@gmail.com> Cc: Neil Brown <neilb@suse.com> Cc: stable@vger.kernel.org Signed-off-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent 6aaafc4 commit f456458

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎fs/nfsd/nfs4state.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@ remove_blocked_locks(struct nfs4_lockowner *lo)
298298
}
299299
}
300300

301+
static void
302+
nfsd4_cb_notify_lock_prepare(struct nfsd4_callback *cb)
303+
{
304+
struct nfsd4_blocked_lock *nbl = container_of(cb,
305+
struct nfsd4_blocked_lock, nbl_cb);
306+
locks_delete_block(&nbl->nbl_lock);
307+
}
308+
301309
static int
302310
nfsd4_cb_notify_lock_done(struct nfsd4_callback *cb, struct rpc_task *task)
303311
{
@@ -325,6 +333,7 @@ nfsd4_cb_notify_lock_release(struct nfsd4_callback *cb)
325333
}
326334

327335
static const struct nfsd4_callback_ops nfsd4_cb_notify_lock_ops = {
336+
.prepare = nfsd4_cb_notify_lock_prepare,
328337
.done = nfsd4_cb_notify_lock_done,
329338
.release = nfsd4_cb_notify_lock_release,
330339
};

0 commit comments

Comments
 (0)