On Mon, 2021-03-15 at 10:46 -0400, J. Bruce Fields wrote: > On Sat, Mar 13, 2021 at 04:08:47PM -0500, trondmy@xxxxxxxxxx wrote: > > From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> > > > > In order to ensure that knfsd threads don't linger once the nfsd > > pseudofs is unmounted (e.g. when the container is killed) we let > > nfsd_umount() shut down those threads and wait for them to exit. > > > > This also should ensure that we don't need to do a kernel mount of > > the pseudofs, since the thread lifetime is now limited by the > > lifetime of the filesystem. > > The nfsd filesystem is per-container, and threads are global, so I > don't > understand how this works. > The knfsd threads are not global. They are assigned at creation time to a struct svc_serv, which is a per-container object. As you say above, all the control structures in the nfsd filesystem are per-container. Without this failsafe that shuts down those threads when the container is killed, then you end up with orphaned threads. This is a real problem when docker crashes and gets restarted (or if you do a 'kill - 9' on the knfsd container's init process). -- Trond Myklebust Linux NFS client maintainer, Hammerspace trond.myklebust@xxxxxxxxxxxxxxx