On Fri, Mar 19 2021, J. Bruce Fields wrote: > On Fri, Mar 19, 2021 at 02:36:24PM +1100, NeilBrown wrote: >> 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. > > Hm, is this the client's trunking-detection logic? Yes. > > In which case, it's not just unconfirmed clients. For NFSv4.1, only the EXCHANGE_ID is duplicate. There is only one CREATE_SESSION, and that is where the client is confirmed. So only one confirmed client. For NFSv4.0 bother SETCLIENTID and SETCLIENDID_CONFIRM are duplicate. So maybe both clients get confirmed. I should check that. > >> So the clean up the logging, mountd needs to be able to see the >> confirmation status. > > That sounds fine. > > (The other possibility might be to just not expose clients till they're > confirmed. I don't know if unconfirmed clients are really that > interesting. But I guess I'd rather err on the side of exposing more > information here.) That was my feeling to: expose all the info, and filter out the uninteresting bits a point of use. Thanks, NeilBrown > >> Following this reply will be a patch to nfsd to provide this status, and >> a patch to mountd/exportd to use this status.
Attachment:
signature.asc
Description: PGP signature