linux-nfs / nfsd

Linux kernel source tree
Other
0 stars 0 forks source link

Calls to fh_verify are frequent and slow #31

Open chucklever opened 7 months ago

chucklever commented 7 months ago

This was bugzilla.linux-nfs.org 396

[Chuck Lever 2022-09-12 17:36:27 UTC] fh_verify() is used to map an incoming filehandle to a dentry on a locally mounted filesystem. In NFSv3, operations carry zero or one filehandle, so there is never more than one call to fh_verify() per request. However, for NFSv4, fh_verify() can be called multiple times per COMPOUND, since each operation may need to check different access modalities for the same filehandle; or the COMPOUND may operation on more than one filehandle.

fh_verify() is a slow operation, on some kernels taking up to 50 microseconds per call. The slow part of the call is nfsd_setuser(), which invokes prepare_creds() and revoke_creds(). These calls often result in memory allocation or release, and can be slow for other reasons as well.

It would be great to make fh_verify() faster, or to split it up into smaller steps, some of which need to be done only once per COMPOUND.