summaryrefslogtreecommitdiffstats
path: root/sys/fs/fifofs
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Fix select on fifos.alfred2002-01-141-11/+29
| | | | | | | | | | | | | Backout revision 1.56 and 1.57 of fifo_vnops.c. Introduce a new poll op "POLLINIGNEOF" that can be used to ignore EOF on a fifo, POLLIN/POLLRDNORM is converted to POLLINIGNEOF within the FIFO implementation to effect the correct behavior. This should allow one to view a fifo pretty much as a data source rather than worry about connections coming and going. Reviewed by: bde
* don't initialize the mutex in the temporary struct file, the soo_*alfred2002-01-141-6/+0
| | | | | | | | functions just grab f_data and don't muck with anything else so this should be ok. this fixes a panic with invariants where it thinks we've doubly initialized the filetmp mutex even though all we've done is neglect to bzero it.
* Include sys/_lock.h and sys/_mutex.h to reduce namespace pollution.alfred2002-01-131-0/+1
| | | | Requested by: jhb
* SMP Lock struct file, filedesc and the global file list.alfred2002-01-131-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Seigo Tanimura (tanimura) posted the initial delta. I've polished it quite a bit reducing the need for locking and adapting it for KSE. Locks: 1 mutex in each filedesc protects all the fields. protects "struct file" initialization, while a struct file is being changed from &badfileops -> &pipeops or something the filedesc should be locked. 1 mutex in each struct file protects the refcount fields. doesn't protect anything else. the flags used for garbage collection have been moved to f_gcflag which was the FILLER short, this doesn't need locking because the garbage collection is a single threaded container. could likely be made to use a pool mutex. 1 sx lock for the global filelist. struct file * fhold(struct file *fp); /* increments reference count on a file */ struct file * fhold_locked(struct file *fp); /* like fhold but expects file to locked */ struct file * ffind_hold(struct thread *, int fd); /* finds the struct file in thread, adds one reference and returns it unlocked */ struct file * ffind_lock(struct thread *, int fd); /* ffind_hold, but returns file locked */ I still have to smp-safe the fget cruft, I'll get to that asap.
* o Make the credential used by socreate() an explicit argument torwatson2001-12-311-2/+4
| | | | | | | | | | | | | | socreate(), rather than getting it implicitly from the thread argument. o Make NFS cache the credential provided at mount-time, and use the cached credential (nfsmount->nm_cred) when making calls to socreate() on initially connecting, or reconnecting the socket. This fixes bugs involving NFS over TCP and ipfw uid/gid rules, as well as bugs involving NFS and mandatory access control implementations. Reviewed by: freebsd-arch
* Fix select on named pipes without a reader.alfred2001-12-121-1/+0
| | | | | PR: kern/19871 MFC after: 1 month
* Switch behavior of fifos to more closely match what goes on in other OSes.alfred2001-11-081-0/+5
| | | | | | | | Basically FIFOs become a real pain to abuse as a rendevous point without this change because you can't really select(2) on them because they always return ready even though there is no writer (to signal EOF). Obtained from: BSD/os
* KSE Milestone 2julian2001-09-121-23/+24
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* The kq write filter was hooked up to the wrong socket, and thus wasjlemon2001-06-061-4/+11
| | | | | | | not behaving correctly. Fix by attaching to the correct socket. Also call so{rw}wakeup in addition to the fifo wakeup, so that any kqfilters attached to the socket buffer get poked.
* - FDESC, FIFO, NULL, PORTAL, PROC, UMAP and UNION fileru2001-05-231-1/+1
| | | | | | | | | | | | | | | systems were repo-copied from sys/miscfs to sys/fs. - Renamed the following file systems and their modules: fdesc -> fdescfs, portal -> portalfs, union -> unionfs. - Renamed corresponding kernel options: FDESC -> FDESCFS, PORTAL -> PORTALFS, UNION -> UNIONFS. - Install header files for the above file systems. - Removed bogus -I${.CURDIR}/../../sys CFLAGS from userland Makefiles.
* Add a vop_stdbmap(), and make it part of the default vop vector.phk2001-04-291-28/+0
| | | | | | Make 7 filesystems which don't really know about VOP_BMAP rely on the default vector, rather than more or less complete local vop_nopbmap() implementations.
* Extend kqueue down to the device layer.jlemon2001-02-151-30/+36
| | | | Backwards compatible approach suggested by: peter
* Introduce vop_stdinactive() and make it the default if no vop_inactivephk2000-08-181-15/+1
| | | | | | is declared. Sort and prune a few vop_op[].
* Add snapshots to the fast filesystem. Most of the changes supportmckusick2000-07-111-0/+1
| | | | | | | | | | | | | | | | | | | | the gating of system calls that cause modifications to the underlying filesystem. The gating can be enabled by any filesystem that needs to consistently suspend operations by adding the vop_stdgetwritemount to their set of vnops. Once gating is enabled, the function vfs_write_suspend stops all new write operations to a filesystem, allows any filesystem modifying system calls already in progress to complete, then sync's the filesystem to disk and returns. The function vfs_write_resume allows the suspended write operations to begin again. Gating is not added by default for all filesystems as for SMP systems it adds two extra locks to such critical kernel paths as the write system call. Thus, gating should only be added as needed. Details on the use and current status of snapshots in FFS can be found in /sys/ufs/ffs/README.snapshot so for brevity and timelyness is not included here. Unless and until you create a snapshot file, these changes should have no effect on your system (famous last words).
* Back out the previous change to the queue(3) interface.jake2000-05-261-2/+2
| | | | | | It was not discussed and should probably not happen. Requested by: msmith and others
* Change the way that the queue(3) structures are declared; don't assume thatjake2000-05-231-2/+2
| | | | | | | | the type argument to *_HEAD and *_ENTRY is a struct. Suggested by: phk Reviewed by: phk Approved by: mdodd
* Introduce kqueue() and kevent(), a kernel event notification facility.jlemon2000-04-161-0/+86
|
* Introduce NDFREE (and remove VOP_ABORTOP)eivind1999-12-151-1/+0
|
* $Id$ -> $FreeBSD$peter1999-08-282-2/+2
|
* Back out DIAGNOSTIC changes.eivind1998-02-061-3/+1
|
* Turn DIAGNOSTIC into a new-style option.eivind1998-02-041-1/+3
|
OpenPOWER on IntegriCloud