2024-04-07 13:43:09

by Charles Hedrick

[permalink] [raw]
Subject: optimization for nfsd_set_fh_dentry

nfsd_set_fh_dentry is used in setfh and a number of other places. It calls exportfs_decode_fh_raw with an argument nfsd_acceptable.

That is a test that always returns 1 if NFSEXP_NOSUBTREECHECK is set.

However there is an optimization in exportfs_decode_fh_raw that skips a lot of file system stuff if NULL is passed as the test. A test that always returns 1 still triggers all the file system stuff, even though it's not needed.

nfsd_set_fh_dentry should pass NULL to exportfs_decode_fh_raw if NFSEXP_NOSUBTREECHECK is set.

I discovered this while looking into a performance problem caused by a pathological client that was sending 40,000 RPCs/sec, almost all get
GETATTR or ACCESS. It was causing the nfsd's to be stuck at 100% CPU by locks in file system code invoked by this unnecessary code.

(We fixed the client by mounting with NFS3 rather than NFS4. This suggests an issue with the NFS 4 client side. Unfortunately I don't have enough information to make a useful report.)





2024-04-08 11:51:14

by Charles Hedrick

[permalink] [raw]
Subject: Re: optimization for nfsd_set_fh_dentry

My apologies. Please ignore this. I misread a backtrace and code.

> nfsd_set_fh_dentry is used in setfh and a number of other places. It calls exportfs_decode_fh_raw with an argument > > >nfsd_acceptable.
>
>That is a test that always returns 1 if NFSEXP_NOSUBTREECHECK is set.
>
>However there is an optimization in exportfs_decode_fh_raw that skips a lot of file system stuff if NULL is passed as the test. A >test that always returns 1 still triggers all the file system stuff, even though it's not needed.
>
>nfsd_set_fh_dentry should pass NULL to exportfs_decode_fh_raw if NFSEXP_NOSUBTREECHECK is set.
>
> discovered this while looking into a performance problem caused by a pathological client that was sending 40,000 RPCs/sec, ?>almost all get
>GETATTR or ACCESS. It was causing the nfsd's to be stuck at 100% CPU by locks in file system code invoked by this unnecessary >code.

(We fixed the client by mounting with NFS3 rather than NFS4. This suggests an issue with the NFS 4 client side. Unfortunately I don't have enough information to make a useful report.)