summaryrefslogtreecommitdiff
path: root/sys/nfs
AgeCommit message (Collapse)Author
2017-12-30Delete unnecessary <sys/file.h> includesPhilip Guenther
ok millert@ krw@
2017-12-11In uvm Chuck decided backing store would not be allocated proactivelyTheo de Raadt
for blocks re-fetchable from the filesystem. However at reboot time, filesystems are unmounted, and since processes lack backing store they are killed. Since the scheduler is still running, in some cases init is killed... which drops us to ddb [noted by bluhm]. Solution is to convert filesystems to read-only [proposed by kettenis]. The tale follows: sys_reboot() should pass proc * to MD boot() to vfs_shutdown() which completes current IO with vfs_busy VB_WRITE|VB_WAIT, then calls VFS_MOUNT() with MNT_UPDATE | MNT_RDONLY, soon teaching us that *fs_mount() calls a copyin() late... so store the sizes in vfsconflist[] and move the copyin() to sys_mount()... and notice nfs_mount copyin() is size-variant, so kill legacy struct nfs_args3. Next we learn ffs_mount()'s MNT_UPDATE code is sharp and rusty especially wrt softdep, so fix some bugs adn add ~MNT_SOFTDEP to the downgrade. Some vnodes need a little more help, so tie them to &dead_vnops. ffs_mount calling DIOCCACHESYNC is causing a bit of grief still but this issue is seperate and will be dealt with in time. couple hundred reboots by bluhm and myself, advice from guenther and others at the hut
2017-11-14Push the NET_LOCK into ifioctl() and use the NET_RLOCK in ifioctl_get().Theo Buehler
In particular, this allows SIOCGIF* requests to run in parallel. lots of help & ok mpi, ok visa, sashan
2017-09-07nfs_connect() returns EINVAL at the beginning if nm_sotype isAlexander Bluhm
invalid. But the compiler cannot know whether it has changed in the meantime, so in the else case a bunch of variables would not be initialized. Add a panic() there to change the compiler's assumptions, the code should not be reached anyway. found by clang -Wuninitialized; OK deraadt@
2017-09-05Preallocate option mbufs in order to reduce solock()/sounlock() dances.Martin Pieuchot
Finally protect the last `so_rcv' and `so_snd' accesses with the socket lock. ok visa@, bluhm@
2017-09-01Change sosetopt() to no longer free the mbuf it receives and changeMartin Pieuchot
all the callers to call m_freem(9). Support from deraadt@ and tedu@, ok visa@, bluhm@
2017-08-29Remove old deactivated pledge path code. A replacement mechanism isTheo de Raadt
being brewed. ok beck
2017-08-14knf to fix tab/space mismatches that make it hard to tell what's insideTed Unangst
an if vs the condition itself. weird contortions because of course the lines want to be like 900 columns wide, but i think it's better now.
2017-08-14drop seriously lacking support for SEQPACKET.Ted Unangst
also move checks up sooner to prevent a (root) panic. ok bluhm
2017-08-11Remove NET_LOCK()'s argument.Martin Pieuchot
Tested by Hrvoje Popovski, ok bluhm@
2017-08-10Move the solock()/sounlock() dance outside of sobind().Martin Pieuchot
ok phessler@, visa@, bluhm@
2017-08-09Move the socket lock "above" sosetopt(), sogetopt() and sosplice().Martin Pieuchot
Protect the fields modifieds by sosetopt() and simplify the dance with the stars. ok bluhm@
2017-07-24Extend the scope of the socket lock to protect `so_state' in connect(2).Martin Pieuchot
As a side effect, soconnect() and soconnect2() now expect a locked socket, so update all the callers. ok bluhm@
2017-07-19If second xdr_string_encode() fails in bp_getfile() m_freem() m sinceClaudio Jeker
this mbuf was allocated by the first call. Fixes possible memory leak. Found by Ilja Van Sprundel OK bluhm@ deraadt@
2017-06-27Add missing solock()/sounlock() dances around sbreserve().Martin Pieuchot
While here document an abuse of parent socket's lock. Problem reported by krw@, analysis and ok bluhm@
2017-06-26Assert that the corresponding socket is locked when manipulating socketMartin Pieuchot
buffers. This is one step towards unlocking TCP input path. Note that all the functions asserting for the socket lock are not necessarilly MP-safe. All the fields of 'struct socket' aren't protected. Introduce a new kernel-only kqueue hint, NOTE_SUBMIT, to be able to tell when a filter needs to lock the underlying data structures. Logic and name taken from NetBSD. Tested by Hrvoje Popovski. ok claudio@, bluhm@, mikeb@
2017-06-19When dealing with mbuf pointers passed down as function parameters,Alexander Bluhm
bugs could easily result in use-after-free or double free. Introduce m_freemp() which automatically resets the pointer before freeing it. So we have less dangling pointers in the kernel. OK krw@ mpi@ claudio@
2017-05-17Remove useless splsoftnet().Martin Pieuchot
Outside of USB, no code is executed in a softnet interrupt context. So what's protecting NFS data structures is the KERNEL_LOCK(). But more importantly, since r1.114 of nfs_socket.c, the 'softnet' thread is no longer executing NFS code. ok visa@
2017-05-08Sync nfs_connect() w/ sys_connect().Martin Pieuchot
ok bluhm@
2017-03-03Prevent a recursion in the socket layer.Martin Pieuchot
Always defere soreceive() to an nfsd(8) process instead of doing it in the 'softnet' thread. Avoiding this recursion ensure that we do not introduce a new sleeping point by releasing and grabbing the netlock. Tested by many, committing now in order to find possible performance regression.
2017-02-22Keep local definitions local.Martin Pieuchot
"good work" deraadt@, ok visa@
2016-12-19Introduce the NET_LOCK() a rwlock used to serialize accesses to the partsMartin Pieuchot
of the network stack that are not yet ready to be executed in parallel or where new sleeping points are not possible. This first pass replace all the entry points leading to ip_output(). This is done to not introduce new sleeping points when trying to acquire ART's write lock, needed when a new L2 entry is created via the RT_RESOLVE. Inputs from and ok bluhm@, ok dlg@
2016-11-22Enforce that ifioctl() is called at IPL_SOFTNET.Martin Pieuchot
This will allow us to keep locking simple as soon as we trade splsoftnet() for a rwlock. ok bluhm@
2016-11-15Switch nfs_timer() to timeout_set_proc(9) as it might end up doing aMartin Pieuchot
PRU_SEND.
2016-09-27replace the use of RB macros with the RBT functions.David Gwynne
2016-09-21Fix nfsrv_symlink() indentation. No binary change.Jonathan Gray
ok mpi@ deraadt@
2016-09-15all pools have their ipl set via pool_setipl, so fold it into pool_init.David Gwynne
the ioff argument to pool_init() is unused and has been for many years, so this replaces it with an ipl argument. because the ipl will be set on init we no longer need pool_setipl. most of these changes have been done with coccinelle using the spatch below. cocci sucks at formatting code though, so i fixed that by hand. the manpage and subr_pool.c bits i did myself. ok tedu@ jmatthew@ @ipl@ expression pp; expression ipl; expression s, a, o, f, m, p; @@ -pool_init(pp, s, a, o, f, m, p); -pool_setipl(pp, ipl); +pool_init(pp, s, a, ipl, f, m, p);
2016-08-30pool_setipl for nfs poolsDavid Gwynne
ok natano@
2016-08-13Eliminate pointless casts to qaddr_t of a value being assigned to a void*Philip Guenther
ok kettenis@ krw@ natano@ dlg@ espie@
2016-07-04Add missing vput() in error path to prevent a vnode getting stuck with aMartin Natano
stale reference and lock, while it shouldn't hold either. "makes sense to me" beck@
2016-06-13make sure attrflag is initialized. from clang via david hillTed Unangst
2016-04-29Fix some gibbering horrors due to uninitialized struct nameidata'sBob Beck
1) turn NDINITAT into a function and make the macros point to it with the later goal of getting rid of them. 2) Sweep the kernel for places where people make a struct nameidata manually on the stack and fill in what they hope are the required fields and count on prayer and clean living to always get them right. Instead use NDINIT everywhere. NFS was especially bad for this and there have likely been things lurking there for a while. 3) Add a couple of strategic KASSERT's to catch future offenders. ok krw@ sthen@ deraadt@
2016-04-26Populate all necessary statfs members in .vfs_statfs. cd9660, udf,Martin Natano
msdosfs and nfsv2 don't set f_namemax. ntfs and ext2fs don't set f_namemeax and f_favail. fusefs doesn't set f_mntfromspec, f_favail and f_iosize. Also, make all filesystems use copy_statfs_info(), so that all statfs information is filled in correctly for the (sb != &mp->mnt-stat) case. ok stefan
2016-03-19Remove the unused flags argument from VOP_UNLOCK().natano
torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
2016-03-17Set mnt_data to NULL after freeing the file system specific mount point.Alexander Bluhm
OK krw@ natano@ as part of a larger diff
2016-02-13Convert to uiomove. From Martin Natano.Stefan Kempf
2016-02-09sync a function's comment with its signaturemmcc
ok tedu@, with a slight tweak
2015-12-22commited -> committedmmcc
2015-12-07NFS can pass a buffer cache buffer straight to VOP_STRATEGY here, so dma_flip isBob Beck
needed. Found by henning@ - thanks! ok deraadt@
2015-09-04The nfsrv_descript_pl pool never gets used in interrupt context.Mark Kettenis
ok deraadt@
2015-09-01Replace sockaddr casts with the proper satosin(), ... calls.Alexander Bluhm
From David Hill; OK mpi@; tested kspillner@; tweaks bluhm@
2015-08-30Keep track of a length for free() in error paths. Be careful,Theo de Raadt
because the nfsm_strsiz() macro sneakily modifies a parameter! ok beck
2015-08-29fix ugly indents; no harmful macros harmedTheo de Raadt
2015-08-28fairly simple sizes for free(); ok teduTheo de Raadt
2015-08-24In kernel initialize struct sockaddr_in and sockaddr_in6 to zeroAlexander Bluhm
everywhere to avoid passing around pointers to uninitialized stack memory. While there, fix the call to in6_recoverscope() in fill_drlist(). OK deraadt@ mpi@
2015-08-14Replace sockaddr casts with the proper satosin() or satosin6() calls.Alexander Bluhm
From David Hill; OK mpi@
2015-07-15m_freem() can handle NULL, do not check for this condition beforehands.Theo de Raadt
ok stsp mpi
2015-07-08MFREE(9) is dead, long live m_freem(9)!Martin Pieuchot
ok bluhm@, claudio@, dlg@
2015-06-16Store a unique ID, an interface index, rather than a pointer to theMartin Pieuchot
receiving interface in the packet header of every mbuf. The interface pointer should now be retrieved when necessary with if_get(). If a NULL pointer is returned by if_get(), the interface has probably been destroy/removed and the mbuf should be freed. Such mechanism will simplify garbage collection of mbufs and limit problems with dangling ifp pointers. Tested by jmatthew@ and krw@, discussed with many. ok mikeb@, bluhm@, dlg@
2015-06-11Convert from hzto(9) to tvtohz(9); OK dlgMike Belopuhov