summaryrefslogtreecommitdiff
path: root/fs
AgeCommit message (Collapse)AuthorFilesLines
2021-01-28NFSv4_2: SSC helper should use its own config.Dai Ngo6-3/+22
Currently NFSv4_2 SSC helper, nfs_ssc, incorrectly uses GRACE_PERIOD as its config. Fix by adding new config NFS_V4_2_SSC_HELPER which depends on NFS_V4_2 and is automatically selected when NFSD_V4 is enabled. Also removed the file name from a comment in nfs_ssc.c. Signed-off-by: Dai Ngo <dai.ngo@oracle.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-28nfsd: cstate->session->se_client -> cstate->clpJ. Bruce Fields2-11/+10
I'm not sure why we're writing this out the hard way in so many places. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-28nfsd: simplify nfsd4_check_open_reclaimJ. Bruce Fields3-19/+5
The set_client() was already taken care of by process_open1(). The comments here are mostly redundant with the code. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-28nfsd: remove unused set_client argumentJ. Bruce Fields1-13/+10
Every caller is setting this argument to false, so we don't need it. Also cut this comment a bit and remove an unnecessary warning. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25nfsd: find_cpntf_state cleanupJ. Bruce Fields1-8/+14
I think this unusual use of struct compound_state could cause confusion. It's not that much more complicated just to open-code this stateid lookup. The only change in behavior should be a different error return in the case the copy is using a source stateid that is a revoked delegation, but I doubt that matters. Signed-off-by: J. Bruce Fields <bfields@redhat.com> [ cel: squashed in fix reported by Coverity ] Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25nfsd: refactor set_clientJ. Bruce Fields1-16/+16
This'll be useful elsewhere. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25nfsd: rename lookup_clientid->set_clientJ. Bruce Fields1-10/+8
I think this is a better name, and I'm going to reuse elsewhere the code that does the lookup itself. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25nfsd: simplify nfsd_renewJ. Bruce Fields1-6/+3
You can take the single-exit thing too far, I think. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25nfsd: simplify process_lockJ. Bruce Fields1-4/+0
Similarly, this STALE_CLIENTID check is already handled by: nfs4_preprocess_confirmed_seqid_op()-> nfs4_preprocess_seqid_op()-> nfsd4_lookup_stateid()-> set_client()-> STALE_CLIENTID() (This may cause it to return a different error in some cases where there are multiple things wrong; pynfs test SEQ10 regressed on this commit because of that, but I think that's the test's fault, and I've fixed it separately.) Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25nfsd4: simplify process_lookup1J. Bruce Fields1-2/+0
This STALE_CLIENTID check is redundant with the one in lookup_clientid(). There's a difference in behavior is in case of memory allocation failure, which I think isn't a big deal. Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25nfsd: report per-export statsAmir Goldstein7-16/+92
Collect some nfsd stats per export in addition to the global stats. A new nfsdfs export_stats file is created. It uses the same ops as the exports file to iterate the export entries and we use the file's name to determine the reported info per export. For example: $ cat /proc/fs/nfsd/export_stats # Version 1.1 # Path Client Start-time # Stats /test localhost 92 fh_stale: 0 io_read: 9 io_write: 1 Every export entry reports the start time when stats collection started, so stats collecting scripts can know if stats where reset between samples. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25nfsd: protect concurrent access to nfsd stats countersAmir Goldstein8-53/+192
nfsd stats counters can be updated by concurrent nfsd threads without any protection. Convert some nfsd_stats and nfsd_net struct members to use percpu counters. The longest_chain* members of struct nfsd_net remain unprotected. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25nfsd: remove unused stats countersAmir Goldstein2-35/+16
Commit 501cb1849f86 ("nfsd: rip out the raparms cache") removed the code that updates read-ahead cache stats counters, commit 8bbfa9f3889b ("knfsd: remove the nfsd thread busy histogram") removed code that updates the thread busy stats counters back in 2009 and code that updated filehandle cache stats was removed back in 2002. Remove the unused stats counters from nfsd_stats struct and print hardcoded zeros in /proc/net/rpc/nfsd. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Clean up after updating NFSv3 ACL decodersChuck Lever2-22/+0
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 SETACL argument decoder to use struct xdr_streamChuck Lever1-18/+13
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv3 GETACL argument decoder to use struct xdr_streamChuck Lever3-6/+17
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Clean up after updating NFSv2 ACL decodersChuck Lever2-19/+0
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 ACL ACCESS argument decoder to use struct xdr_streamChuck Lever1-5/+6
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 ACL GETATTR argument decoder to use struct xdr_streamChuck Lever1-11/+1
Since the ACL GETATTR procedure is the same as the normal GETATTR procedure, simply re-use nfssvc_decode_fhandleargs. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 SETACL argument decoder to use struct xdr_streamChuck Lever2-18/+13
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Add an xdr_stream-based decoder for NFSv2/3 ACLsChuck Lever1-0/+52
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 GETACL argument decoder to use struct xdr_streamChuck Lever4-7/+17
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Remove argument length checking in nfsd_dispatch()Chuck Lever1-34/+0
Now that the argument decoders for NFSv2 and NFSv3 use the xdr_stream mechanism, the version-specific length checking logic in nfsd_dispatch() is no longer necessary. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 SYMLINK argument decoder to use struct xdr_streamChuck Lever1-103/+10
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 CREATE argument decoder to use struct xdr_streamChuck Lever1-6/+4
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 SETATTR argument decoder to use struct xdr_streamChuck Lever1-6/+76
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 LINK argument decoder to use struct xdr_streamChuck Lever1-6/+4
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 RENAME argument decoder to use struct xdr_streamChuck Lever1-7/+5
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update NFSv2 diropargs decoding to use struct xdr_streamChuck Lever1-5/+34
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 READDIR argument decoder to use struct xdr_streamChuck Lever1-5/+7
As an additional clean up, move code not related to XDR decoding into readdir's .pc_func call out. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Add helper to set up the pages where the dirlist is encodedChuck Lever3-14/+18
Add a helper similar to nfsd3_init_dirlist_pages(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 READLINK argument decoder to use struct xdr_streamChuck Lever3-23/+5
If the code that sets up the sink buffer for nfsd_readlink() is moved adjacent to the nfsd_readlink() call site that uses it, then the only argument is a file handle, and the fhandle decoder can be used instead. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 WRITE argument decoder to use struct xdr_streamChuck Lever1-31/+21
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 READ argument decoder to use struct xdr_streamChuck Lever3-39/+30
The code that sets up rq_vec is refactored so that it is now adjacent to the nfsd_read() call site where it is used. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv2 GETATTR argument decoder to use struct xdr_streamChuck Lever3-9/+23
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the MKNOD3args decoder to use struct xdr_streamChuck Lever1-72/+35
This commit removes the last usage of the original decode_sattr3(), so it is removed as a clean-up. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the SYMLINK3args decoder to use struct xdr_streamChuck Lever1-13/+16
Similar to the WRITE decoder, code that checks the sanity of the payload size is re-wired to work with xdr_stream infrastructure. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the MKDIR3args decoder to use struct xdr_streamChuck Lever1-6/+4
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the CREATE3args decoder to use struct xdr_streamChuck Lever1-10/+10
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the SETATTR3args decoder to use struct xdr_streamChuck Lever1-17/+121
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the LINK3args decoder to use struct xdr_streamChuck Lever1-6/+4
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the RENAME3args decoder to use struct xdr_streamChuck Lever1-7/+5
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update the NFSv3 DIROPargs decoder to use struct xdr_streamChuck Lever1-5/+35
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update COMMIT3arg decoder to use struct xdr_streamChuck Lever1-5/+8
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update READDIR3args decoders to use struct xdr_streamChuck Lever2-15/+24
As an additional clean up, neither nfsd3_proc_readdir() nor nfsd3_proc_readdirplus() make use of the dircount argument, so remove it from struct nfsd3_readdirargs. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Add helper to set up the pages where the dirlist is encodedChuck Lever3-31/+19
De-duplicate some code that is used by both READDIR and READDIRPLUS to build the dirlist in the Reply. Because this code is not related to decoding READ arguments, it is moved to a more appropriate spot. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Fix returned READDIR offset cookieChuck Lever1-3/+4
Code inspection shows that the server's NFSv3 READDIR implementation handles offset cookies slightly differently than the NFSv2 READDIR, NFSv3 READDIRPLUS, and NFSv4 READDIR implementations, and there doesn't seem to be any need for this difference. As a clean up, I copied the logic from nfsd3_proc_readdirplus(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update READLINK3arg decoder to use struct xdr_streamChuck Lever3-23/+5
The NFSv3 READLINK request takes a single filehandle, so it can re-use GETATTR's decoder. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update WRITE3arg decoder to use struct xdr_streamChuck Lever1-31/+20
As part of the update, open code that sanity-checks the size of the data payload against the length of the RPC Call message has to be re-implemented to use xdr_stream infrastructure. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2021-01-25NFSD: Update READ3arg decoder to use struct xdr_streamChuck Lever3-27/+25
The code that sets up rq_vec is refactored so that it is now adjacent to the nfsd_read() call site where it is used. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>