summaryrefslogtreecommitdiff
path: root/sys/nfs
AgeCommit message (Collapse)Author
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.
2021-10-19vnode: remove VLOCKSWORK and check locking when vop_islocked != nullopSebastien Marie
This flag is currently used to mark or unmark a vnode to actively check vnode locking semantic (when compiled with VFSLCKDEBUG). Currently, VLOCKSWORK flag isn't properly set for several FS implementation which have full locking support. This commit enable proper checking for them too (cd9660, udf, fuse, msdosfs, tmpfs). Instead of using a particular flag, it directly check if v_op->vop_islocked is nullop or not to activate or not the vnode locking checks. ok mpi@
2021-10-19vnode: do not manipulate vnode lock directlySebastien Marie
use VOP_LOCK / VOP_UNLOCK wrappers. VOP_LOCK() is prefered over vn_lock() here in order to keep equivalent code. ok mpi@ visa@ (as part of larger diff)
2021-10-02vfs: merge *_badop to vop_generic_badopSebastien Marie
It replaces spec_badop, fifo_badop, dead_badop and mfs_badop, which are only calls to panic(9), to one unique function vop_generic_badop(). No intented behaviour changes (outside the panic message which isn't the same). ok mpi@
2021-03-11spellingJonathan Gray
2021-01-19nfs/nfs_boot.c: convert ifunit() to if_unit(9)mvs
ok dlg@
2021-01-02nfs: don't sleep on lboltcheloha
We can simulate the current behavior without lbolt by sleeping for 1 second on the &nowake channel. ok mpi@
2020-12-25Refactor klist insertion and removalVisa Hankala
Rename klist_{insert,remove}() to klist_{insert,remove}_locked(). These functions assume that the caller has locked the klist. The current state of locking remains intact because the kernel lock is still used with all klists. Add new functions klist_insert() and klist_remove() that lock the klist internally. This allows some code simplification. OK mpi@
2020-09-27In the previous commit, check tv_nsec, not tv_sec as VNOVAL is aMatthieu Herrb
valid valuse of tv_sec but an invalid value for tv_nsec. Noticed by guenther@. ok beck@ deraadt@
2020-09-27nfs_create: after an exclusive create rpc, make sure to updateMatthieu Herrb
timestamps. This issue was iscovered after rsync 3.2 changed behaviour on an NFS mounted partition.. Change lifted from NetBSD (r 1.204). ok beck@, kn@, deraadt@
2020-08-24According the code `nfsbootdevname' is always set to network device namemvs
we expected. Remove the `else' path from nfs_boot_init(). If `nfsbootdevname' is not set something goes wrong and this is the panic condition. Also we exclude the case where we can get `ifp' which we don't expect. OK mpi@