Skip to content

Eliminate delegation self-conflicts

J. Bruce Fields linux-fsdevel linux-nfs lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7kthreads: minor kthreadd refactoringkernel/kthread.c+19 -140 replies
2/7kthreads: Simplify tsk_fork_get_nodeinit/init_task.c kernel/fork.c kernel/kthread.c+8 -20 replies
3/7kthreads: allow multiple kthreadd'sinclude/linux/kthread.h init/main.c kernel/kthread.c+107 -301 reply
4/7kthreads: allow cloning threads with different flagsinclude/linux/kthread.h kernel/kthread.c+9 -50 replies
5/7rpc: separate out body of svc_start_kthreadsnet/sunrpc/svc.c+37 -250 replies
6/7rpc: move rpc server threads into their own thread groupinclude/linux/sunrpc/svc.h net/sunrpc/svc.c+19 -50 replies
7/7nfsd: ignore delegation self-conflictsfs/locks.c fs/nfsd/nfs4state.c fs/nfsd/state.h +2 more+130 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/7] Eliminate delegation self-conflicts

From: "J. Bruce Fields" <[email protected]>

These patches allow NFSv4 clients holding delegations to keep them when the operation that would break a delegation comes from the same client.

To do that, we somehow need to pass the identity of the delegation-breaker down through the VFS.

This series uses the tgid, a solution suggested by Trond. To do that we need nfsd tasks to share the same tgid. I do that by extending the kthread code slightly to allow knfsd to run the kthreadd main loop in a task of its own, and spawn its server threads off of that task.

Part of Trond's thinking was that this would work for userspace too. Delegations are currently only available to knfsd, but Ganesha and Samba may eventually be interested in a userspace interface (probably a minor variation on the fcntl F_{GET,SET}LEASE interface). A threaded userspace server would first resolve conflicts between its own clients, and then call into the kernel to break any leases acquired by other processes. That may require some careful locking of the server's own data structures, but it should work.

Previously I considered instead adding a new field somewhere in the struct task. That might require a new system call to expose to user space. Or we might be able to put this in a keyring, if David Howells thought that would work.

Before that I tried passing the identity of the breaker explicitly, but that looks like it would require passing the new argument around to huge swaths of the VFS.

I'm testing this with some a locally modified pynfs; I'll fix that up and push it out at some point, but pynfs has a number of bugs in this area.

I wasn't sure who to ask about the kthread.c changes, so I'm cc'ing a random assortment of developers in recent changelogs, hope that's OK.

--b.

J. Bruce Fields (7):
kthreads: minor kthreadd refactoring
kthreads: Simplify tsk_fork_get_node
kthreads: allow multiple kthreadd's
kthreads: allow cloning threads with different flags
rpc: separate out body of svc_start_kthreads
rpc: move rpc server threads into their own thread group
nfsd: ignore delegation self-conflicts

 fs/locks.c                 |  39 +++++++++++
 fs/nfsd/nfs4state.c        |  61 ++++++++++++++++
 fs/nfsd/state.h            |   2 +
 fs/nfsd/vfs.c              |  32 +++++++--
 include/linux/fs.h         |   2 +
 include/linux/kthread.h    |  21 +++++-
 include/linux/sunrpc/svc.h |   1 +
 init/init_task.c           |   3 +
 init/main.c                |   4 +-
 kernel/fork.c              |   4 ++
 kernel/kthread.c           | 140 +++++++++++++++++++++++++++----------
 net/sunrpc/svc.c           |  83 ++++++++++++++--------
 12 files changed, 317 insertions(+), 75 deletions(-)
Signature · 1 line
2.20.1