summaryrefslogtreecommitdiff
path: root/sys/nfs
AgeCommit message (Collapse)Author
2024-11-05remove VATTR_NULL() define, directly call vattr_null()Jonathan Gray
There used to be a predefined null vattr for !DIAGNOSTIC but that was removed in vnode.h rev 1.84 in 2007. ok semarie@ miod@
2024-10-30directly use dev_t for swdevt[], remove struct swdevtJonathan Gray
ok mpi@ miod@
2024-10-18Put the bowels of the various VOP_PRINT routines underMiod Vallat
defined(DEBUG) || defined(DIAGNOSTIC) || defined(VFSLCKDEBUG) as they won't be used otherwise. Shaves a few bytes off installation kernels. ok kn@ semarie@
2024-09-18remove unneeded semicolons after switch statementsJonathan Gray
2024-09-12Ensure that file names passed back by readdir do not include a '/'Claudio Jeker
character. The '/' char is the path separator and is not allowed in any filename. NFS specific report by Apple Security Engineering and Architecture (SEAR). Input from guenther@ and millert@ OK beck@ miod@
2024-09-11After calling m_freem() on nmi_mrep (or nmi_mreq) set the pointer to NULL.Claudio Jeker
Only do this if struct nfsm_info doesn't have local scope. In some cases the caller would perfrom another m_freem and double free the mbuf and Bad Things(TM) would happen. Reported by Claes M Nyberg on bugs@; with & ok miod@
2024-09-10nfsm_srvnamesiz() may set up an NFSERR_NAMETOL error, which nfsm_reply() wouldMiod Vallat
consider as not tragic enough to abort the operation, in order to batch error replies. This would end up invoking nfs_namei() using an uninitialized variable as length, and Bad Things(TM) would happen. Reported by Claes M Nyberg on bugs@; tweaks & ok claudio@
2024-09-09move some server only functions from nfs_subs.c to nfs_srvsubs.cJonathan Gray
saves space on ramdisks that have option NFSCLIENT initial diff from and ok miod@
2024-09-04Fix some spelling.Marcus Glocker
Input and ok jmc@, jsg@
2024-08-17avoid uninitialised var use in nfs_serv.c error pathsJonathan Gray
some functions have a nfsmout label with code that assumes NDINIT has been called nfsrv_rename has two NDINIT calls, the nfsmout code assumes both are setup but is only jumped to when none/one is setup found with llvm scan-build checked by deraadt@ beck@, ok miod@
2024-07-12Switch `so_snd' of udp(4) sockets to the new locking scheme.Vitaliy Makkoveev
udp_send() and following udp{,6}_output() do not append packets to `so_snd' socket buffer. This mean the sosend() and sosplice() sending paths are dummy pru_send() and there is no problems to simultaneously run them on the same socket. Push shared solock() deep down to sesend() and take it only around pru_send(), but keep somove() running unedr exclusive solock(). Since sosend() doesn't modify `so_snd' the unlocked `so_snd' space checks within somove() are safe. Corresponding `sb_state' and `sb_flags' modifications are protected by `sb_mtx' mutex(9). Tested and OK bluhm.
2024-07-06remove unused nfs_null()Jonathan Gray
ok miod@ mlarkin@
2024-06-26return type on a dedicated line when declaring functionsJonathan Gray
ok mglocker@
2024-05-14remove unneeded nfs_getreq() prototypeJonathan Gray
nfs_getreq() is in nfs_socket.c and not called from nfs_vnops.c
2024-05-13vfs: VOP_REMOVE: move vnode unlocking and ref dropping to FS-indep partSebastien Marie
while here, ensure all vop_remove field are set, and always call the function. the change is very conservative: it only adds vnode ref drop/unlock where it was absent because it should be unreachable (and if it wasn't, it should fix things). ok miod@
2024-05-12nfs_procids was removed in 1996Jonathan Gray
2024-05-04remove prototypes for removed functionsJonathan Gray
2024-05-04remove some unused definesJonathan Gray
ok miod@
2024-05-01remove unneeded includesJonathan Gray
ok miod@ mpi@
2024-04-30Make nfstov_mode() return mode_t rather than uint16_t.Miod Vallat
This is a no-op since we only care about the low 12 bits in NFS anyway. ok jsg@ semarie@
2024-04-30Constify NFS data whenever possible. Also make a few more const data static.Miod Vallat
ok jsg@ semarie@
2024-04-30Convert all the NFS macros (in nfsm_subs.h) into inline functions with theMiod Vallat
appropriate extra arguments. This (hopefully) completes the unmessyfication work started by thib@ a long, long time ago (in a galaxy far away). The conversion logic has been: - nfsm_dissect has been turned into an rvalue expression, leaving the cast operation up to its caller. - macros which had three different exit paths (return, goto nfsmout or fallthrough) have been split so that no macros have more than two exit paths. - then they have been modified to return a value, which lets the caller figure out what exit path is needed. - local variables abused by the macros are now local variables of the new inline functions. This single commit is the sum of 25 intermediate diffs, which have all been carefully reviewed by (at least) jsg@ and semarie@. Tested with v2 and v3 servers and clients. ok jsg@ semarie@
2024-04-30Do not cast off_t to u_long in uvm_vnp_setsize call (only misbehaves on 32-bitMiod Vallat
platforms.) ok mpi@
2024-04-19nfs: Permit null requests (aka server pings) from non-reserved portsAlexandre Ratchov
Unfortunately, this is recommended by rfc 2623 and used by Linux nfs-utils to mount NFS exports. So until nfs-utils switches into using reserved ports, this is needed to mount OpenBSD file-systems on most (all?) Linux distros. Bits from claudio, ok millert
2024-04-13correct indentationJonathan Gray
no functional change, found by smatch warnings ok miod@ bluhm@
2024-03-31Mark `so_rcv' sockbuf of udp(4) sockets as SB_OWNLOCK.Vitaliy Makkoveev
sbappend*() and soreceive() of SB_MTXLOCK marked sockets uses `sb_mtx' mutex(9) for protection, meanwhile buffer usage check and corresponding sbwait() sleep still serialized by solock(). Mark udp(4) as SB_OWNLOCK to avoid solock() serialization and rely to `sb_mtx' mutex(9). The `sb_state' and `sb_flags' modifications must be protected by `sb_mtx' too. ok bluhm
2024-03-25Move the "no (hard) linking directories" and "no cross-mount links"Philip Guenther
checks from all the filesystems that support hardlinks at all into the VFS layer. Simplify, EPERM description in link(2). ok miod@ mpi@
2024-03-22Limit NFS connections to originate from a reserved port.Claudio Jeker
For TCP connections do the check when adding the socket via nfssvc(2). For UDP do the check early after soreceive(). On top of this limit the sockets added via nfssvc(2) to IPv4 TCP and UDP sockets. OK millert@ deraadt@
2024-02-05Use `sb_mtx' mutex(9) to protect `sb_timeo_nsecs'. In most placesVitaliy Makkoveev
solock() is still held because other 'sockbuf' members require it, but in so{g,s}etopt() paths solock() is avoided. ok bluhm
2024-01-12nfssvc: When the client disconnects, close the socket before sleeping.Alexandre Ratchov
If the server doesn't close the socket immediately and starts waiting for the client to reconnect, then the TCP connection will remain open. The client will have to wait for the connection to be closed in order to reconnect with the same source port; this never happens, resulting in a freeze until the file system is umounted. This change fixes Linux NFS clients freezing after 5 min of inactivity. ok miod, help from claudio
2023-09-08Remove the remnants of the leftover selinfo from vnode(9) layer. JustVitaliy Makkoveev
mechanical 'selinfo' to 'klist' replacement in 'vnode' structure because knote(9) API is already used. <sys/selinfo.h> headers added where is was required. ok bluhm
2023-08-03Move solock() down to sosetopt(). A part of standalone sblock() work.Vitaliy Makkoveev
This movement required because buffers related SO_SND* and SO_RCV* socket options should be protected with sblock(). However, standalone sblock() has different lock order with solock() and `so_snd' and `so_rcv' buffers. At least sblock() for `so_snd' buffer will always be taken before solock() in the sosend() path. The (*pr_ctloutput)() call was removed from the SOL_SOCKET level 'else' branch. Except the SO_RTABLE case where it handled in the special way, this is null op call. For SO_SND* and SO_RCV* cases solock() will be replaced by sblock() in the future. Feedback from bluhm Tested by bluhm naddy ok bluhm
2023-04-26Don't redeclare s, it's already there.Bob Beck
noticed by miod@ ok kettenis@
2023-04-26Fix missing splbio() needed in nfsBob Beck
ok claudio@ kettenis@
2023-03-08Delete obsolete /* ARGSUSED */ lint comments.Philip Guenther
ok miod@ millert@
2022-08-13Introduce the pru_*() wrappers for corresponding (*pr_usrreq)() calls.Vitaliy Makkoveev
This is helpful for the following (*pr_usrreq)() split to multiple handlers. But right now this makes code more readable. Also add '#ifndef _SYS_SOCKETVAR_H_' to sys/socketvar.h. This prevents the collisions when both sys/protosw.h and sys/socketvar.h are included together. Both 'socket' and 'protosw' structures are required to be defined before pru_*() wrappers, so we need to include sys/socketvar.h to sys/protosw.h. ok bluhm@
2022-08-12Put more struct vnode fields under splbio().Visa Hankala
Buffer cache related struct vnode fields can be accessed in interrupt context. Be more consistent with the use of splbio(). OK mpi@
2022-06-27Fix lock order reversal in nfs_inactive()Visa Hankala
Make the silly file removal happen after the vnode has been unlocked. This avoids a file-directory reversal in the vnode locking order. OK jca@
2022-06-26Remove unused VOP_POLL().Visa Hankala
OK mpi@
2022-06-06Simplify solock() and sounlock(). There is no reason to return a valueClaudio Jeker
for the lock operation and to pass a value to the unlock operation. sofree() still needs an extra flag to know if sounlock() should be called or not. But sofree() is called less often and mostly without keeping the lock. OK mpi@ mvs@
2022-05-27Call uvm_vnp_uncache() before VOP_RENAME().Martin Pieuchot
ok kettenis@
2022-05-22Lock kernel in nfsrv_rcv() because NFS subsystem is not MP-safe yet.Visa Hankala
Tested in snaps for a week. OK bluhm@
2022-03-17Use the refcnt API with struct ucred.Visa Hankala
OK bluhm@
2022-03-05remove fddi leftoverJonathan Gray
no binary change
2022-02-22Delete unnecessary #includes of <sys/domain.h> and/or <sys/protosw.h>Philip Guenther
net/if_pppx.c pointed out by jsg@ ok gnezdo@ deraadt@ jsg@ mpi@ millert@
2022-01-12fixup previous refactoringmbuhl
OK stsp@ (without assuming any responsibility for NFS)
2022-01-11spellingJonathan Gray
ok jmc@
2021-12-12Add vnode parameter to VOP_STRATEGY()Visa Hankala
Pass the device vnode as a parameter to VOP_STRATEGY() to allow calling the correct vop_strategy callback. Now the vnode is also available in the callback. OK mpi@
2021-12-11Clarify usage of __EV_POLL and __EV_SELECTVisa Hankala
Make __EV_POLL specific to kqueue-based poll(2), to remove overlap with __EV_SELECT that only select(2) uses. OK millert@ mpi@
2021-10-20revert vnode: remove VLOCKSWORK and check locking when vop_islocked != nullopSebastien Marie
(both kernel and userland bits) GENERIC + VFSLCKDEBUG is broken with it.