On Mon, Mar 01 2021, J. Bruce Fields wrote: > On Tue, Mar 02, 2021 at 02:01:36PM +1100, NeilBrown wrote: >> On Mon, Mar 01 2021, J. Bruce Fields wrote: >> >> > I've gotten requests for similar functionality, and intended to >> > implement it using directory notifications on /proc/fs/nfsd/clients. >> >> I've been exploring this a bit. >> When I mount a filesystem, 2 clients get created. >> With NFSv4.0, the second client is immediately deleted, and the first >> client is deleted one grace period after the filesystem is unmounted. >> With NFSv4.1 and 4.2, the first client is immediately deleted, and the >> second client is deleted immediately after the unmount. > > Yeah, internally it's creating an "unconfirmed client" on SETCLIENTID > (or EXCHANGE_ID) and then a new "confirmed client" on > SETCLIENTID_CONFIRM (or CREATE_SESSION). > > I'm not sure why the ordering's a little different between the 4.0/4.1+ > cases. The multiple clients are not really nfsd's "fault". The Linux NFS client sends multiple EXCHANGE_ID or SET_CLIENT_ID requests, so NFSD really does need to create multiple clients. For NFSv4.0, when nfsd gets a repeat SET_CLIENT_ID, it keeps the old one and discards the new. For NFSv4.1, the spec requires that it keep the new one and discard the old. This explains the different ordering. So the clean up the logging, mountd needs to be able to see the confirmation status. Following this reply will be a patch to nfsd to provide this status, and a patch to mountd/exportd to use this status. Thanks, NeilBrown
Attachment:
signature.asc
Description: PGP signature