summaryrefslogtreecommitdiff
path: root/sys/fs/nfs
Commit message (Collapse)AuthorAgeFilesLines
* VFS_QUOTACTL: Remove needless casts of argBrooks Davis2020-12-171-7/+7
| | | | | | | | | | | | | | | The argument is a void * so there's no need to cast it to caddr_t. Update documentation to match function decleration. Reviewed by: freqlabs Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27093 Notes: svn path=/head/; revision=368744
* nfs: Mark unused statistics variable as reservedAlan Somers2020-11-182-22/+15
| | | | | | | | | | | | | | | FreeBSD's NFS exporter has long exported some unused statistics fields. Revision r366992 removed them from nfsstat. This revision renames those fields in the kernel's exported structures to make it clear to other consumers that they are unused. Reported by: emaste Reviewed by: emaste Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D27258 Notes: svn path=/head/; revision=367785
* Do not copy vp into f_data for DTYPE_VNODE files.Konstantin Belousov2020-09-151-1/+1
| | | | | | | | | | | | | | | | The pointer to vnode is already stored into f_vnode, so f_data can be reused. Fix all found users of f_data for DTYPE_VNODE. Provide finit_vnode() helper to initialize file of DTYPE_VNODE type. Reviewed by: markj (previous version) Discussed with: freqlabs (openzfs chunk) Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D26346 Notes: svn path=/head/; revision=365783
* fs: clean up empty lines in .c and .h filesMateusz Guzik2020-09-019-22/+13
| | | | Notes: svn path=/head/; revision=365070
* Add flags to enable NFS over TLS to the NFS client and server.Rick Macklem2020-08-273-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An Internet Draft titled "Towards Remote Procedure Call Encryption By Default" (soon to be an RFC I think) describes how Sun RPC is to use TLS with NFS as a specific application case. Various commits prepared the NFS code to use KERN_TLS, mainly enabling use of ext_pgs mbufs for large RPC messages. r364475 added TLS support to the kernel RPC. This commit (which is the final one for kernel changes required to do NFS over TLS) adds support for three export flags: MNT_EXTLS - Requires a TLS connection. MNT_EXTLSCERT - Requires a TLS connection where the client presents a valid X.509 certificate during TLS handshake. MNT_EXTLSCERTUSER - Requires a TLS connection where the client presents a valid X.509 certificate with "user@domain" in the otherName field of the SubjectAltName during TLS handshake. Without these export options, clients are permitted, but not required, to use TLS. For the client, a new nmount(2) option called "tls" makes the client do a STARTTLS Null RPC and TLS handshake for all TCP connections used for the mount. The CLSET_TLS client control option is used to indicate to the kernel RPC that this should be done. Unless the above export flags or "tls" option is used, semantics should not change for the NFS client nor server. For NFS over TLS to work, the userspace daemons rpctlscd(8) { for client } or rpctlssd(8) daemon { for server } must be running. Notes: svn path=/head/; revision=364896
* Delete the unused "use_ext" argument to nfscl_reqstart().Rick Macklem2020-08-183-19/+11
| | | | | | | | | | This is a partial revert of r363210, since the "use_ext" argument added by that commit is not actually useful. This patch should not result in any semantics change. Notes: svn path=/head/; revision=364330
* Add an argument to newnfs_connect() that indicates use TLS for the connection.Rick Macklem2020-08-114-25/+7
| | | | | | | | | | | | | | | | | | For NFSv4.0, the server creates a server->client TCP connection for callbacks. If the client mount on the server is using TLS, enable TLS for this callback TCP connection. TLS connections from clients will not be supported until the kernel RPC changes are committed. Since this changes the internal ABI between the NFS kernel modules that will require a version bump, delete newnfs_trimtrailing(), which is no longer used. Since LCL_TLSCB is not yet set, these changes should not have any semantic affect at this time. Notes: svn path=/head/; revision=364092
* Add optional support for ext_pgs mbufs to the NFS server's read, readlinkRick Macklem2020-07-311-3/+3
| | | | | | | | | | | | | | | | | | | | and getxattr operations. This patch optionally enables generation of read, readlink and getxattr replies in ext_pgs mbufs. Since neither of ND_EXTPG or ND_TLS are currently ever set, there is no change in semantics at this time. It also corrects the message in a couple of panic()s that should never occur. This is another in the series of commits that add support to the NFS client and server for building RPC messages in ext_pgs mbufs with anonymous pages. This is useful so that the entire mbuf list does not need to be copied before calling sosend() when NFS over TLS is enabled. Use of ext_pgs mbufs will not be enabled until the kernel RPC is updated to handle TLS. Notes: svn path=/head/; revision=363748
* Fix the NFSv4 client so that it checks for support of TimeCreate beforeRick Macklem2020-07-261-2/+13
| | | | | | | | | | | | | trying to set it. r362490 added support for setting of the TimeCreate (va_birthtime) attribute, but it does so without checking to see if the server supports the attribute. This could result in NFSERR_ATTRNOTSUPP error replies to the Setattr operation. This patch adds code to check that the server supports TimeCreate before attempting to do a Setattr of it to avoid these error returns. Notes: svn path=/head/; revision=363587
* Add support for ext_pgs mbufs to nfsrv_adj().Rick Macklem2020-07-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This patch uses a slightly different algorithm for nfsrv_adj() since ext_pgs mbuf lists are not permitted to have m_len == 0 mbufs. As such, the code now frees mbufs after the adjustment in the list instead of setting their m_len field to 0. Since mbuf(s) may be trimmed off the tail of the list, the function now returns a pointer to the last mbuf in the list. This saves the caller from needing to use m_last() to find the last mbuf. It also implies that it might return a nul list, which required a check for that in nfsrvd_readlink(). This is another in the series of commits that add support to the NFS client and server for building RPC messages in ext_pgs mbufs with anonymous pages. This is useful so that the entire mbuf list does not need to be copied before calling sosend() when NFS over TLS is enabled. Use of ext_pgs mbufs will not be enabled until the kernel RPC is updated to handle TLS. Notes: svn path=/head/; revision=363541
* Add support for ext_pgs mbufs to nfsm_uiombuflist() and nfsm_split().Rick Macklem2020-07-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch uses a slightly different algorithm for nfsm_uiombuflist() for the non-ext_pgs case, where a variable called "mcp" is maintained, pointing to the current location that mbuf data can be filled into. This avoids use of mtod(mp, char *) + mp->m_len to calculate the location, since this does not work for ext_pgs mbufs and I think it makes the algorithm more readable. This change should not result in semantic changes for the non-ext_pgs case. The patch also deletes come unneeded code. It also adds support for anonymous page ext_pgs mbufs to nfsm_split(). This is another in the series of commits that add support to the NFS client and server for building RPC messages in ext_pgs mbufs with anonymous pages. This is useful so that the entire mbuf list does not need to be copied before calling sosend() when NFS over TLS is enabled. At this time for this case, use of ext_pgs mbufs cannot be enabled, since ktls_encrypt() replaces the unencrypted data with encrypted data in place. Until such time as this can be enabled, there should be no semantic change. Also, note that this code is only used by the NFS client for a mirrored pNFS server. Notes: svn path=/head/; revision=363499
* Add support for ext_pgs mbufs to nfsrvd_rephead().Rick Macklem2020-07-071-13/+22
| | | | | | | | | | | | This is another in the series of commits that add support to the NFS client and server for building RPC messages in ext_pgs mbufs with anonymous pages. This is useful so that the entire mbuf list does not need to be copied before calling sosend() when NFS over TLS is enabled. Since ND_EXTPG is never set yet, there is no semantic change at this time. Notes: svn path=/head/; revision=362980
* Add support for ext_pgs mbufs to nfsm_strtom().Rick Macklem2020-07-052-12/+73
| | | | | | | | | | | | | | Also, add a new function nfsm_add_ext_pgs() which will either add a page or add a new ext_pgs mbuf with a page to the mbuf list. Used by nfsm_strtom(). This is another in the series of commits that add support to the NFS client and server for building RPC messages in ext_pgs mbufs with anonymous pages. This is useful so that the entire mbuf list does not need to be copied before calling sosend() when NFS over TLS is enabled. Since ND_EXTPG is never set yet, there is no semantic change at this time. Notes: svn path=/head/; revision=362949
* Add support for ext_pgs mbufs to nfscl_reqstart() and nfsm_set().Rick Macklem2020-07-041-8/+45
| | | | | | | | | | | | This is another in the series of commits that add support to the NFS client and server for building RPC messages in ext_pgs mbufs with anonymous pages. This is useful so that the entire mbuf list does not need to be copied before calling sosend() when NFS over TLS is enabled. Since ND_EXTPG is never set yet, there is no semantic change at this time. Notes: svn path=/head/; revision=362917
* Fix build breakage caused by r362903. Only pmap.h is needed now, butRick Macklem2020-07-031-0/+3
| | | | | | | | | vm_page.h and vm_pageout.h is needed later, so put them in now. Pointy hat goes on me. Notes: svn path=/head/; revision=362906
* Add support for ext_pgs mbufs to nfsm_build().Rick Macklem2020-07-032-3/+17
| | | | | | | | | | | | This is the first of a series of commits that add support to the NFS client and server for building RPC messages in ext_pgs mbufs with anonymous pages. This is useful so that the entire mbuf list does not need to be copied before calling sosend() when NFS over TLS is enabled. Since ND_EXTPG is never set yet, there is no semantic change at this time. Notes: svn path=/head/; revision=362903
* Add a boolean argument to nfscl_reqstart() to indicate that ext_pgs mbufsRick Macklem2020-06-264-4/+19
| | | | | | | | | | | | | | | | | | | | | should be used. For KERN_TLS (and possibly some other future network interface) the mbuf list passed into sosend() must be ext_pgs mbufs. The krpc could simply copy all the mbuf data into ext_pgs mbufs before calling sosend(), but that would be inefficient for large RPC messages. This patch adds an argument to nfscl_reqstart() to indicate that it should fill the RPC message into ext_pgs mbufs. It also adds fields to "struct nfsrv_descript" needed for building NFS RPC messages in ext_pgs mbufs, along with new flags for this. Since the argument is always "false", this commit should not result in any semantic change. However, this commit prepares the code for future commits that will add support for building of NFS RPC messages in ext_pgs mbufs. Notes: svn path=/head/; revision=362639
* Add some missing parts for supporting va_birthtime.Doug Rabson2020-06-223-2/+14
| | | | | | | Reviewed by: rmacklem Notes: svn path=/head/; revision=362490
* Remove vfs_statfs and vnode_mount macros from NFSAlan Somers2020-06-174-18/+5
| | | | | | | | | | | | | | | These macro definitions are no longer needed as the NFS OSX port is long dead. The vfs_statfs macro conflicts with the vfsops field of the same name. Submitted by: shivank@ Reviewed by: rmacklem MFC after: 2 weeks Sponsored by: Google, Inc. (GSoC 2020) Differential Revision: https://reviews.freebsd.org/D25263 Notes: svn path=/head/; revision=362280
* Add support for the timecreate attributeDoug Rabson2020-06-141-0/+5
| | | | | | | This maps to the va_birthtime VFS attribute. Notes: svn path=/head/; revision=362175
* Fix export_args ex_flags field so that is 64bits, the same as mnt_flags.Rick Macklem2020-06-142-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since mnt_flags was upgraded to 64bits there has been a quirk in "struct export_args", since it hold a copy of mnt_flags in ex_flags, which is an "int" (32bits). This happens to currently work, since all the flag bits used in ex_flags are defined in the low order 32bits. However, new export flags cannot be defined. Also, ex_anon is a "struct xucred", which limits it to 16 additional groups. This patch revises "struct export_args" to make ex_flags 64bits and replaces ex_anon with ex_uid, ex_ngroups and ex_groups (which points to a groups list, so it can be malloc'd up to NGROUPS in size. This requires that the VFS_CHECKEXP() arguments change, so I also modified the last "secflavors" argument to be an array pointer, so that the secflavors could be copied in VFS_CHECKEXP() while the export entry is locked. (Without this patch VFS_CHECKEXP() returns a pointer to the secflavors array and then it is used after being unlocked, which is potentially a problem if the exports entry is changed. In practice this does not occur when mountd is run with "-S", but I think it is worth fixing.) This patch also deleted the vfs_oexport_conv() function, since do_mount_update() does the conversion, as required by the old vfs_cmount() calls. Reviewed by: kib, freqlabs Relnotes: yes Differential Revision: https://reviews.freebsd.org/D25088 Notes: svn path=/head/; revision=362158
* Deduplicate fsid comparisonsRyan Moeller2020-05-211-2/+1
| | | | | | | | | | | | | | | | Comparing fsid_t objects requires internal knowledge of the fsid structure and yet this is duplicated across a number of places in the code. Simplify by creating a fsidcmp function (macro). Reviewed by: mjg, rmacklem Approved by: mav (mentor) MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D24749 Notes: svn path=/head/; revision=361313
* Add a function nfsm_set() to initialize "struct nfsrv_descript" for buildingRick Macklem2020-05-182-0/+12
| | | | | | | | | | | | mbuf lists. This function is currently trivial, but will that will change when support for building NFS messages in ext_pgs mbufs is added. Adding support for ext_pgs mbufs is needed for KERN_TLS, which will be used to implement nfs-over-tls. Notes: svn path=/head/; revision=361146
* Remove unused header for DES.John Baldwin2020-05-131-1/+0
| | | | | | | The NFS port doesn't use any of the DES functions. Notes: svn path=/head/; revision=361013
* nfs: Remove APPLESTATIC macroRyan Moeller2020-05-123-44/+39
| | | | | | | | | | | | | It is no longer useful. Reviewed by: rmacklem Approved by: mav (mentor) MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D24811 Notes: svn path=/head/; revision=360960
* Remove APPLEKEXT ifndefsRyan Moeller2020-05-082-4/+0
| | | | | | | | | | | | | They are no longer useful. Reviewed by: rmacklem Approved by: mav (mentor) MFC after: 1 week Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D24752 Notes: svn path=/head/; revision=360813
* Delete unused function newnfs_trimleading.Rick Macklem2020-05-062-48/+0
| | | | | | | | | | | | | The NFS function called newnfs_trimleading() has not been used by the code in long time. To give you a clue, it still had a K&R style function declaration. Delete it, since it is just cruft, as a part of the NFS mbuf handling cleanup in preparation for adding ext_pgs mbuf support. The ext_pgs mbuf support for the build/send side is needed by nfs-over-tls. Notes: svn path=/head/; revision=360678
* Revert r360514, to avoid unnecessary churn of the sources.Rick Macklem2020-05-052-97/+25
| | | | | | | | | | | | | r360514 prepared the NFS code for changes to handle ext_pgs mbufs on the receive side. However, at this time, KERN_TLS does not pass ext_pgs mbufs up through soreceive(). As such, as this time, only the send/build side of the NFS mbuf code needs to handle ext_pgs mbufs. Revert r360514 since the rather extensive changes required for receive side ext_pgs mbufs are not yet needed. This avoids unnecessary churn of the sources. Notes: svn path=/head/; revision=360650
* Factor some code out of nfsm_dissct() into separate functions.Rick Macklem2020-05-012-25/+97
| | | | | | | | | | | | | | Factoring some of the code in nfsm_dissct() out into separate functions allows these functions to be used elsewhere in the NFS mbuf handling code. Other uses of these functions will be done in future commits. It also makes it easier to add support for ext_pgs mbufs, which is needed for nfs-over-tls under development in base/projects/nfs-over-tls. Although the algorithm in nfsm_dissct() is somewhat re-written by this patch, the semantics of nfsm_dissct() should not have changed. Notes: svn path=/head/; revision=360514
* Get rid of uio_XXX macros used for the Mac OS/X port.Rick Macklem2020-04-281-16/+0
| | | | | | | | | | | | | The NFS code had a bunch of Mac OS/X accessor functions named uio_XXX left over from the port to Mac OS/X. Since that port is long forgotten, replace the calls with the code generated by the FreeBSD macros for these in nfskpiport.h. This allows the macros to be deleted from nfskpiport.h and I think makes the code more readable. This patch should not result in any semantic change. Notes: svn path=/head/; revision=360424
* Remove Mac OS/X macros that did nothing for FreeBSD.Rick Macklem2020-04-252-9/+4
| | | | | | | | | | | | | The macros CAST_USER_ADDR_T() and CAST_DOWN() were used for the Mac OS/X port. The first of these macros was a no-op for FreeBSD and the second is no longer used. This patch gets rid of them. It also deletes the "mbuf_t" typedef which is no longer used in the FreeBSD code from nfskpiport.h This patch should not change semantics. Notes: svn path=/head/; revision=360289
* Make the NFSv4.n client's recovery from NFSERR_BADSESSION RFC5661 conformant.Rick Macklem2020-04-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | RFC5661 specifies that a client's recovery upon receipt of NFSERR_BADSESSION should first consist of a CreateSession operation using the extant ClientID. If that fails, then a full recovery beginning with the ExchangeID operation is to be done. Without this patch, the FreeBSD client did not attempt the CreateSession operation with the extant ClientID and went directly to a full recovery beginning with ExchangeID. I have had this patch several years, but since no extant NFSv4.n server required the CreateSession with extant ClientID, I have never committed it. I an committing it now, since I suspect some future NFSv4.n server will require this and it should not negatively impact recovery for extant NFSv4.n servers, since they should all return NFSERR_STATECLIENTID for this first CreateSession. The patched client has been tested for recovery against both the FreeBSD and Linux NFSv4.n servers and no problems have been observed. MFC after: 1 month Notes: svn path=/head/; revision=360205
* Replace all instances of the typedef mbuf_t with "struct mbuf *".Rick Macklem2020-04-174-20/+20
| | | | | | | | | | | | | The typedef mbuf_t was used for the Mac OS/X port of the code long ago. Since this port is no longer used and the use of mbuf_t obscures what the code does (and is not consistent with style(9)), it is no longer needed. This patch replaces all instances of mbuf_t with "struct mbuf *", so that it is no longer used. This patch should not result in any semantic change. Notes: svn path=/head/; revision=360055
* Delete the mbuf macros that were used for the Mac OS/X port.Rick Macklem2020-04-132-10/+0
| | | | | | | | | | | | | | When the code was ported to Mac OS/X, mbuf handling functions were converted to using the Mac OS/X accessor functions. For FreeBSD, they are a simple set of macros in sys/fs/nfs/nfskpiport.h. Since r359757, r359780, r359785, r359810, r359811 have removed all uses of these macros, this patch deleted the macros from the .h files. My eventual goal is deleting nfskpiport.h, but that will take some more editting to replace uses of the remaining macros. Notes: svn path=/head/; revision=359840
* Replace mbuf macros with the code they would generate in the NFS code.Rick Macklem2020-04-111-1/+1
| | | | | | | | | | | | | | | | | | | When the code was ported to Mac OS/X, mbuf handling functions were converted to using the Mac OS/X accessor functions. For FreeBSD, they are a simple set of macros in sys/fs/nfs/nfskpiport.h. Since porting to Mac OS/X is no longer a consideration, replacement of these macros with the code generated by them makes the code more readable. When support for external page mbufs is added as needed by the KERN_TLS, the patch becomes simpler if done without the macros. This patch should not result in any semantic change. This is the final patch of this series and the macros should now be able to be deleted from the .h files in a future commit. Notes: svn path=/head/; revision=359811
* Replace mbuf macros with the code they would generate in the NFS code.Rick Macklem2020-04-112-6/+6
| | | | | | | | | | | | | | | | When the code was ported to Mac OS/X, mbuf handling functions were converted to using the Mac OS/X accessor functions. For FreeBSD, they are a simple set of macros in sys/fs/nfs/nfskpiport.h. Since porting to Mac OS/X is no longer a consideration, replacement of these macros with the code generated by them makes the code more readable. When support for external page mbufs is added as needed by the KERN_TLS, the patch becomes simpler if done without the macros. This patch should not result in any semantic change. Notes: svn path=/head/; revision=359810
* Replace mbuf macros with the code they would generate in the NFS code.Rick Macklem2020-04-091-57/+57
| | | | | | | | | | | | | | | | | When the code was ported to Mac OS/X, mbuf handling functions were converted to using the Mac OS/X accessor functions. For FreeBSD, they are a simple set of macros in sys/fs/nfs/nfskpiport.h. Since porting to Mac OS/X is no longer a consideration, replacement of these macros with the code generated by them makes the code more readable. When support for external page mbufs is added as needed by the KERN_TLS, the patch becomes simpler if done without the macros. This patch should not result in any semantic change. This conversion will be committed one file at a time. Notes: svn path=/head/; revision=359757
* Remove the old NFS lock device driver that uses Giant.Rick Macklem2020-04-091-0/+2
| | | | | | | | | | | | | | | | | This NFS lock device driver was replaced by the kernel NLM around FreeBSD7 and has not normally been used since then. To use it, the kernel had to be built without "options NFSLOCKD" and the nfslockd.ko had to be deleted as well. Since it uses Giant and is no longer used, this patch removes it. With this device driver removed, there is now a lot of unused code in the userland rpc.lockd. That will be removed on a future commit. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D22933 Notes: svn path=/head/; revision=359745
* Fix noisy NFSv4 server printf.Rick Macklem2020-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | Peter reported that his dmesg was getting cluttered with nfsrv_cache_session: no session messages when he rebooted his NFS server and they did not seem useful. He was correct, in that these messages are "normal" and expected when NFSv4.1 or NFSv4.2 are mounted and the server is rebooted. This patch silences the printf() during the grace period after a reboot. It also adds the client IP address to the printf(), so that the message is more useful if/when it occurs. If this happens outside of the server's grace period, it does indicate something is not working correctly. Instead of adding yet another nd_XXX argument, the arguments for nfsrv_cache_session() were simplified to take a "struct nfsrv_descript *". Reported by: pen@lysator.liu.se MFC after: 2 weeks Notes: svn path=/head/; revision=359679
* Simplify td_ucred handling in newnfs_connect().Mark Johnston2020-03-261-8/+3
| | | | | | | | | No functional change intended. MFC after: 1 week Notes: svn path=/head/; revision=359331
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-1/+2
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Add missing comma in nfsv4_errstrEric van Gyzen2020-01-131-1/+1
| | | | | | | | | Reported by: Coverity CID: 1412243 Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=356705
* vfs: drop the mostly unused flags argument from VOP_UNLOCKMateusz Guzik2020-01-032-3/+3
| | | | | | | | | | | Filesystems which want to use it in limited capacity can employ the VOP_UNLOCK_FLAGS macro. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D21427 Notes: svn path=/head/; revision=356337
* Change NFSv4.1 and NFSv4.2 error strings to start with lower case letter.Rick Macklem2019-12-261-46/+46
| | | | | | | | | | | r356084 added error strings for NFSv4.1 and NFSv4.2, with the first character capitalized. Since the other error strings were not capitalized and these strings would usually be imbedded in an error, I decided to make the first characters lower cased. No real effect but more consistent. Notes: svn path=/head/; revision=356099
* Add NFSv4.1 and NFSv4.2 errors to nfsv4_errstr.h.Rick Macklem2019-12-251-3/+51
| | | | | | | | | | | | nfsv4_errstr.h only had strings for NFSv4.0 errors. This patch adds the errors for NFSv4.1 and NFSv4.2. At this time, this file is not used by any sources in the tree, so the change is not significant. I do plan on using nfsv4_errstr.h in a future patch to mount_nfs.c. Since I am doing this patch so that "minor version mismatch" will be recognized, I made that string less abbreviated. Notes: svn path=/head/; revision=356084
* Add support for NFSv4.2 to the NFS client and server.Rick Macklem2019-12-127-29/+345
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for NFSv4.2 (RFC-7862) and Extended Attributes (RFC-8276) to the NFS client and server. NFSv4.2 is comprised of several optional features that can be supported in addition to NFSv4.1. This patch adds the following optional features: - posix_fadvise(POSIX_FADV_WILLNEED/POSIX_FADV_DONTNEED) - posix_fallocate() - intra server file range copying via the copy_file_range(2) syscall --> Avoiding data tranfer over the wire to/from the NFS client. - lseek(SEEK_DATA/SEEK_HOLE) - Extended attribute syscalls for "user" namespace attributes as defined by RFC-8276. Although this patch is fairly large, it should not affect support for the other versions of NFS. However it does add two new sysctls that allow a sysadmin to limit which minor versions of NFSv4 a server supports, allowing a sysadmin to disable NFSv4.2. Unfortunately, when the NFS stats structure was last revised, it was assumed that there would be no additional operations added beyond what was specified in RFC-7862. However RFC-8276 did add additional operations, forcing the NFS stats structure to revised again. It now has extra unused entries in all arrays, so that future extensions to NFSv4.2 can be accomodated without revising this structure again. A future commit will update nfsstat(1) to report counts for the new NFSv4.2 specific operations/procedures. This patch affects the internal interface between the nfscommon, nfscl and nfsd modules and, as such, they all must be upgraded simultaneously. I will do a version bump (although arguably not needed), due to this. This code has survived a "make universe" but has not been built with a recent GCC. If you encounter build problems, please email me. Relnotes: yes Notes: svn path=/head/; revision=355677
* Fix kernel handling of a NFSERR_MINORVERSMISMATCH NFSv4 server reply.Rick Macklem2019-12-081-1/+2
| | | | | | | | | | | | | | | | | | | | When an NFSv4 server replies NFSERR_MINORVERSMISMATCH, it does not generate a status result for the first operation in the compound. Without this patch, this will result in a bogus EBADXDR error return. Returning EBADXDR is relatively harmless, but a correct reply of NFSERR_MINORVERSMISMATCH is needed by the pNFS client to select the correct minor version to use for a File Layout DS now that there can be NFSv4.2 DS servers. mount_nfs.c still needs to be fixed for this, although how the mount fails is only useful to help sysadmins isolate why a mount fails. Found during testing of the NFSv4.2 client and server. MFC after: 2 weeks Notes: svn path=/head/; revision=355509
* Add some definitions for NFSv4.2 which will be used by subsequent commits.Rick Macklem2019-12-071-1/+54
| | | | | | | | | | | | This is a preliminary commit of NFSv4.2 definitions that will be used by subsequent commits which adds NFSv4.2 support to the NFS client and server. There will be a series of these preliminary commits that will prepare for a major commit of the NFSv4.2 client/server changes currently found in subversion under projects/nfsv42/sys. Notes: svn path=/head/; revision=355507
* Set the XATTRSUPPORT attribute bit for NFSv4.2, always cleared for now.Rick Macklem2019-12-071-1/+2
| | | | | | | | | | | | | Since r355472 added code which clears the XATTRSUPPORT bit for non-NFSv4.2 mounts, it is now safe to set it. There will be a series of these preliminary commits that will prepare for a major commit of the NFSv4.2 client/server changes currently found in subversion under projects/nfsv42/sys. This commit completes updates to nfsproto.h required by the NFSv4.2. Notes: svn path=/head/; revision=355479
* Add a couple of definitions for NFSv4.2 and update macros to use them.Rick Macklem2019-12-061-0/+8
| | | | | | | | | | | | | This patch adds code to macros to clear attribute bits not supported by NFSv4.2. For now, these bits are never set anyhow, but this prepares the code for the addition of NFSv4.2 support in a future commit. There will be a series of these preliminary commits that will prepare for a major commit of the NFSv4.2 client/server changes currently found in subversion under projects/nfsv42/sys. Notes: svn path=/head/; revision=355472