summaryrefslogtreecommitdiffstats
path: root/sys/fs/fifofs
Commit message (Collapse)AuthorAgeFilesLines
* Whitespace in vop_vector{} initializations.phk2005-01-131-0/+1
|
* /* -> /*- for copyright notices, minor format tweaks as necessaryimp2005-01-062-2/+2
|
* Don't forget to bypass vnodes in corner cases.phk2004-12-131-8/+6
| | | | | Found by: kkenn and ports/shell/zsh Thanks to: jeffr
* Explicitly panic vop_read/vop_write on fifos.phk2004-12-131-0/+2
|
* Back when VOP_* was introduced, we did not have new-style structphk2004-12-012-43/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | initializations but we did have lofty goals and big ideals. Adjust to more contemporary circumstances and gain type checking. Replace the entire vop_t frobbing thing with properly typed structures. The only casualty is that we can not add a new VOP_ method with a loadable module. History has not given us reason to belive this would ever be feasible in the the first place. Eliminate in toto VOCALL(), vop_t, VNODEOP_SET() etc. Give coda correct prototypes and function definitions for all vop_()s. Generate a bit more data from the vnode_if.src file: a struct vop_vector and protype typedefs for all vop methods. Add a new vop_bypass() and make vop_default be a pointer to another struct vop_vector. Remove a lot of vfs_init since vop_vector is ready to use from the compiler. Cast various vop_mumble() to void * with uppercase name, for instance VOP_PANIC, VOP_NULL etc. Implement VCALL() by making vdesc_offset the offsetof() the relevant function pointer in vop_vector. This is disgusting but since the code is generated by a script comparatively safe. The alternative for nullfs etc. would be much worse. Fix up all vnode method vectors to remove casts so they become typesafe. (The bulk of this is generated by scripts)
* Mechanically change prototypes for vnode operations to use the new typedefs.phk2004-12-011-7/+7
|
* Add dropped implementation of ioctl for fifos.phk2004-11-181-1/+20
|
* Make vnode bypass for fifos (read, write, poll) mandatory.phk2004-11-171-133/+6
|
* Add file ops to fifofs so that we can bypass vnodes (and Giant) for thephk2004-11-151-1/+164
| | | | | | heavy-duty operations (read, write, poll/select, kqueue). Disabled for now, enable with "vfs.fifofs.fops=1" in loader.conf.
* fifos doesn't need a vop_lookup, the default will do fine.phk2004-11-131-19/+0
|
* Properly implement a default version of VOP_GETWRITEMOUNT.phk2004-11-061-1/+0
| | | | | Remove improper access to vop_stdgetwritemount() which should and will instead rely on the VOP default path.
* Add locking to the kqueue subsystem. This also makes the kqueue subsystemjmg2004-08-151-5/+5
| | | | | | | | | | | | | a more complete subsystem, and removes the knowlege of how things are implemented from the drivers. Include locking around filter ops, so a module like aio will know when not to be unloaded if there are outstanding knotes using it's filter ops. Currently, it uses the MTX_DUPOK even though it is not always safe to aquire duplicate locks. Witness currently doesn't support the ability to discover if a dup lock is ok (in some cases). Reviewed by: green, rwatson (both earlier versions)
* Remove unlocked read annotation for sbspace(); the read is locked.rwatson2004-06-231-1/+0
|
* Merge some additional leaf node socket buffer locking fromrwatson2004-06-181-6/+27
| | | | | | | | | | | | | | | | | | | | | rwatson_netperf: Introduce conditional locking of the socket buffer in fifofs kqueue filters; KNOTE() will be called holding the socket buffer locks in fifofs, but sometimes the kqueue() system call will poll using the same entry point without holding the socket buffer lock. Introduce conditional locking of the socket buffer in the socket kqueue filters; KNOTE() will be called holding the socket buffer locks in the socket code, but sometimes the kqueue() system call will poll using the same entry points without holding the socket buffer lock. Simplify the logic in sodisconnect() since we no longer need spls. NOTE: To remove conditional locking in the kqueue filters, it would make sense to use a separate kqueue API entry into the socket/fifo code when calling from the kqueue() system call.
* Merge additional socket buffer locking from rwatson_netperf:rwatson2004-06-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | - Lock down low hanging fruit use of sb_flags with socket buffer lock. - Lock down low hanging fruit use of so_state with socket lock. - Lock down low hanging fruit use of so_options. - Lock down low-hanging fruit use of sb_lowwat and sb_hiwat with socket buffer lock. - Annotate situations in which we unlock the socket lock and then grab the receive socket buffer lock, which are currently actually the same lock. Depending on how we want to play our cards, we may want to coallesce these lock uses to reduce overhead. - Convert a if()->panic() into a KASSERT relating to so_state in soaccept(). - Remove a number of splnet()/splx() references. More complex merging of socket and socket buffer locking to follow.
* Grab the socket buffer send or receive mutex when performing arwatson2004-06-151-0/+6
| | | | | | read-modify-write on the sb_state field. This commit catches only the "easy" ones where it doesn't interact with as yet unmerged locking.
* The socket field so_state is used to hold a variety of socket relatedrwatson2004-06-141-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | flags relating to several aspects of socket functionality. This change breaks out several bits relating to send and receive operation into a new per-socket buffer field, sb_state, in order to facilitate locking. This is required because, in order to provide more granular locking of sockets, different state fields have different locking properties. The following fields are moved to sb_state: SS_CANTRCVMORE (so_state) SS_CANTSENDMORE (so_state) SS_RCVATMARK (so_state) Rename respectively to: SBS_CANTRCVMORE (so_rcv.sb_state) SBS_CANTSENDMORE (so_snd.sb_state) SBS_RCVATMARK (so_rcv.sb_state) This facilitates locking by isolating fields to be located with other identically locked fields, and permits greater granularity in socket locking by avoiding storing fields with different locking semantics in the same short (avoiding locking conflicts). In the future, we may wish to coallesce sb_state and sb_flags; for the time being I leave them separate and there is no additional memory overhead due to the packing/alignment of shorts in the socket buffer structure.
* Add MSG_NBIO flag option to soreceive() and sosend() that causestruckman2004-06-011-12/+6
| | | | | | | | | | | | them to behave the same as if the SS_NBIO socket flag had been set for this call. The SS_NBIO flag for ordinary sockets is set by fcntl(fd, F_SETFL, O_NONBLOCK). Pass the MSG_NBIO flag to the soreceive() and sosend() calls in fifo_read() and fifo_write() instead of frobbing the SS_NBIO flag on the underlying socket for each I/O operation. The O_NONBLOCK flag is a property of the descriptor, and unlike ordinary sockets, fifos may be referenced by multiple descriptors.
* Switch from using the vnode interlock to a private mutex in fifo_open()truckman2004-05-171-24/+23
| | | | | | | | to avoid lock order problems when manipulating the sockets associated with the fifo. Minor optimization of a couple of calls to fifo_cleanup() from fifo_open().
* Remove advertising clause from University of California Regent'simp2004-04-072-8/+0
| | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson
* Export uipc_connect2() from uipc_usrreq.c instead of unp_connect2(),rwatson2004-03-311-1/+1
| | | | | | | | | | and consume that interface in portalfs and fifofs instead. In the new world order, unp_connect2() assumes that the unpcb mutex is held, whereas uipc_connect2() validates that the passed sockets are UNIX domain sockets, then grabs the mutex. NB: the portalfs and fifofs code gets down and dirty with UNIX domain sockets. Maybe this is a bad thing.
* Use "fip->fi_readers == 0 && fip->fi_writers == 0" as the condition fortruckman2003-11-161-6/+3
| | | | | | | | | | disposing fifo resources in fifo_cleanup() instead using of "vp->v_usecount == 1". There may be other references to the vnode, for instance by nullfs, at the time fifo_open() or fifo_close() is called, which could cause a resource leak. Don't bother grabbing the vnode interlock in fifo_cleanup() since it no longer accesses v_usecount.
* If fifo_open() is interrupted, fifo_close() may not get called, causingtruckman2003-11-101-9/+23
| | | | | | | | | a resource leak. Move the resource deallocation code from fifo_close() to a new function, fifo_cleanup(), and call fifo_cleanup() from fifo_close() and the appropriate places in fifo_open(). Tested by: Lukas Ertl Pointy hat to: truckman
* Partially back out rev 1.87 by nuking fifo_inactive() and moving thetruckman2003-06-161-20/+4
| | | | | | | | resource deallocation back to fifo_close(). This eliminates any stale data that might be stuck in the socket buffers after all the readers and writers have closed the fifo. Tested by: Thorsten Schroeder <ths@katjusha.de>
* Clean up the fifo_open() implementation:truckman2003-06-131-45/+30
| | | | | | | | | | | | | Restructure the error handling portion of the resource allocation code to eliminate duplicated code. Test for the O_NONBLOCK && fi_readers == 0 case before incrementing fi_writers and modifying the the socket flag to avoid having to undo these operations in this error case. Restructure and simplify the code that handles blocking opens. There should be no change to functionality.
* Fix up locking problems in fifo_open() and fifo_close():truckman2003-06-011-25/+73
| | | | | | | | | | | | | | | | | | | | | Sleep on the vnode interlock while waiting for another caller to increment fi_readers or fi_writers. Hold the vnode interlock while incrementing fi_readers or fi_writers to prevent a wakeup from being missed. Only access fi_readers and fi_writers while holding the vnode lock. Previously fifo_close() decremented their values without holding a lock. Move resource deallocation from fifo_close() to fifo_inactive(), which allows the VOP_CLOSE() call in the error return path in fifo_open() to be removed. Fifo_open() was calling VOP_CLOSE() with the vnode lock held, in violation the current vnode locking API. Also the way fifo_close() used vrefcnt() to decide whether to deallocate resources was bogus according to comments in the vrefcnt() implementation. Reviewed by: bde
* Remove unused variable.phk2003-05-311-2/+1
| | | | Found by: FlexeLint
* Better fix for the problem addressed by rev.1.79: don't loop inbde2003-03-241-8/+13
| | | | | | | | | | | | | fifo_open() waiting for another reader or writer if one arrived and departed while we were waiting (or a little earlier). Rev.1.79 broke blocking opens of fifos by making them time out after 1 second. This was bad for at least apsfilter. Tested by: "Simon 'corecode' Schubert" <corecode@corecode.ath.cx>, Alexander Leidinger <Alexander@leidinger.net>, phk MFC after: 4 weeks
* More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9).des2003-03-021-4/+4
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-1/+1
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-1/+1
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Bow to the whining masses and change a union back into void *. Retaindillon2003-01-131-6/+7
| | | | | removal of unnecessary casts and throw in some minor cleanups to see if anyone complains, just for the hell of it.
* Change struct file f_data to un_data, a union of the correct structdillon2003-01-121-6/+6
| | | | | | | | | | pointer types, and remove a huge number of casts from code using it. Change struct xfile xf_data to xun_data (ABI is still compatible). If we need to add a #define for f_data and xf_data we can, but I don't think it will be necessary. There are no operational changes in this commit.
* There is some sort of race/deadlock which I have not identifiedphk2002-12-291-1/+6
| | | | | | | | | | here. It manifests itself by sendmail hanging in "fifoow" during boot on a diskless machine with sendmail disabled. Giving the sleep a 1sec timout breaks the deadlock, but does not solve the underlying problem. XXX comment applied.
* Fix comments and one resulting code confusion about the type of thephk2002-10-161-1/+1
| | | | | | "command" argument to VOP_IOCTL. Spotted by: FlexeLint.
* Be consistent about "static" functions: if the function is markedphk2002-09-281-1/+1
| | | | | | static in its prototype, mark it static at the definition too. Inspired by: FlexeLint warning #512
* - Use vrefcnt() where it is safe to do so instead of doing direct andjeff2002-09-251-1/+1
| | | | | | | unlocked accesses to v_usecount. - Lock access to the buf lists in the various sync routines. interlock locking could be avoided almost entirely in leaf filesystems if the fsync function had a generic helper.
* Remove any VOP_PRINT that redundantly prints the tag.njl2002-09-181-2/+0
| | | | | | Move lockmgr_printinfo() into vprint() for everyone's benefit. Suggested by: bde
* Remove all use of vnode->v_tag, replacing with appropriate substitutes.njl2002-09-141-1/+1
| | | | | | | | | | | | v_tag is now const char * and should only be used for debugging. Additionally: 1. All users of VT_NTS now check vfsconf->vf_type VFCF_NETWORK 2. The user of VT_PROCFS now checks for the new flag VV_PROCDEP, which is propagated by pseudofs to all child vnodes if the fs sets PFS_PROCDEP. Suggested by: phk Reviewed by: bde, rwatson (earlier version)
* Handle one more case of a fifofs filetmp: set filetmp.f_cred torwatson2002-08-201-2/+3
| | | | | | | | ap->a_cred, and pass in ap->a_td->td_ucred as the active_cred to soo_poll(). Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* In continuation of early fileop credential changes, modify fo_ioctl() torwatson2002-08-171-2/+6
| | | | | | | | | | | | | | | | | | | | | | accept an 'active_cred' argument reflecting the credential of the thread initiating the ioctl operation. - Change fo_ioctl() to accept active_cred; change consumers of the fo_ioctl() interface to generally pass active_cred from td->td_ucred. - In fifofs, initialize filetmp.f_cred to ap->a_cred so that the invocations of soo_ioctl() are provided access to the calling f_cred. Pass ap->a_td->td_ucred as the active_cred, but note that this is required because we don't yet distinguish file_cred and active_cred in invoking VOP's. - Update kqueue_ioctl() for its new argument. - Update pipe_ioctl() for its new argument, pass active_cred rather than td_ucred to MAC for authorization. - Update soo_ioctl() for its new argument. - Update vn_ioctl() for its new argument, use active_cred rather than td->td_ucred to authorize VOP_IOCTL() and the associated VOP_GETATTR(). Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Make similar changes to fo_stat() and fo_poll() as made earlier torwatson2002-08-161-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fo_read() and fo_write(): explicitly use the cred argument to fo_poll() as "active_cred" using the passed file descriptor's f_cred reference to provide access to the file credential. Add an active_cred argument to fo_stat() so that implementers have access to the active credential as well as the file credential. Generally modify callers of fo_stat() to pass in td->td_ucred rather than fp->f_cred, which was redundantly provided via the fp argument. This set of modifications also permits threads to perform these operations on behalf of another thread without modifying their credential. Trickle this change down into fo_stat/poll() implementations: - badfo_poll(), badfo_stat(): modify/add arguments. - kqueue_poll(), kqueue_stat(): modify arguments. - pipe_poll(), pipe_stat(): modify/add arguments, pass active_cred to MAC checks rather than td->td_ucred. - soo_poll(), soo_stat(): modify/add arguments, pass fp->f_cred rather than cred to pru_sopoll() to maintain current semantics. - sopoll(): moidfy arguments. - vn_poll(), vn_statfile(): modify/add arguments, pass new arguments to vn_stat(). Pass active_cred to MAC and fp->f_cred to VOP_POLL() to maintian current semantics. - vn_close(): rename cred to file_cred to reflect reality while I'm here. - vn_stat(): Add active_cred and file_cred arguments to vn_stat() and consumers so that this distinction is maintained at the VFS as well as 'struct file' layer. Pass active_cred instead of td->td_ucred to MAC and to VOP_GETATTR() to maintain current semantics. - fifofs: modify the creation of a "filetemp" so that the file credential is properly initialized and can be used in the socket code if desired. Pass ap->a_td->td_ucred as the active credential to soo_poll(). If we teach the vnop interface about the distinction between file and active credentials, we would use the active credential here. Note that current inconsistent passing of active_cred vs. file_cred to VOP's is maintained. It's not clear why GETATTR would be authorized using active_cred while POLL would be authorized using file_cred at the file system level. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Back out my lats commit of locking down a socket, it conflicts with hsu's work.tanimura2002-05-311-30/+4
| | | | Requested by: hsu
* Lock the writer socket across sorwakeup(fip->fi_writesock).tanimura2002-05-211-1/+3
| | | | Spotted by: peter
* Lock down a socket, milestone 1.tanimura2002-05-201-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Add a mutex (sb_mtx) to struct sockbuf. This protects the data in a socket buffer. The mutex in the receive buffer also protects the data in struct socket. o Determine the lock strategy for each members in struct socket. o Lock down the following members: - so_count - so_options - so_linger - so_state o Remove *_locked() socket APIs. Make the following socket APIs touching the members above now require a locked socket: - sodisconnect() - soisconnected() - soisconnecting() - soisdisconnected() - soisdisconnecting() - sofree() - soref() - sorele() - sorwakeup() - sotryfree() - sowakeup() - sowwakeup() Reviewed by: alfred
* Use vop_panic() instead of rolling our own.phk2002-05-021-23/+11
|
* Revert the change of #includes in sys/filedesc.h and sys/socketvar.h.tanimura2002-04-301-8/+10
| | | | | | | | | | Requested by: bde Since locking sigio_lock is usually followed by calling pgsigio(), move the declaration of sigio_lock and the definitions of SIGIO_*() to sys/signalvar.h. While I am here, sort include files alphabetically, where possible.
* Cleanup of logic, flow and comments.alfred2002-04-181-20/+18
| | | | Submitted by: bde
* Remove __P.alfred2002-03-192-14/+14
|
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredjhb2002-02-271-2/+2
| | | | reference.
OpenPOWER on IntegriCloud