summaryrefslogtreecommitdiffstats
path: root/sys/fs/fifofs
Commit message (Collapse)AuthorAgeFilesLines
* - Improve comments about locking of the "struct fifoinfo" which is a bitattilio2009-11-061-8/+9
| | | | | | | | unclear. - Fix a memory leak [0] [0] Diagnosed by: Dorr H. Clark <dclark at engr dot scu dot edu> MFC: 1 week
* Provide default implementation for VOP_ACCESS(9), so that filesystems whichtrasz2009-10-011-1/+0
| | | | | | | want to provide VOP_ACCESSX(9) don't have to implement both. Note that this commit makes implementation of either of these two mandatory. Reviewed by: kib
* Use C99 initialization for struct filterops.rwatson2009-09-121-6/+15
| | | | | | Obtained from: Mac OS X Sponsored by: Apple Inc. MFC after: 3 weeks
* Fix poll() on half-closed sockets, while retaining POLLHUP for fifos.jilles2009-08-251-0/+3
| | | | | | | | | | | | | This reverts part of r196460, so that sockets only return POLLHUP if both directions are closed/error. Fifos get POLLHUP by closing the unused direction immediately after creating the sockets. The tools/regression/poll/*poll.c tests now pass except for two other things: - if POLLHUP is returned, POLLIN is always returned as well instead of only when there is data left in the buffer to be read - fifo old/new reader distinction does not work the way POSIX specs it Reviewed by: kib, bde
* Fix poll(2) and select(2) for named pipes to return "ready for read"kib2009-07-071-20/+14
| | | | | | | | | | | | | | | | | when all writers, observed by reader, exited. Use writer generation counter for fifo, and store the snapshot of the fifo generation in the f_seqcount field of struct file, that is otherwise unused for fifos. Set FreeBSD-undocumented POLLINIGNEOF flag only when file f_seqcount is equal to fifo' fi_wgen, and revert r89376. Fix POLLINIGNEOF for sockets and pipes, and return POLLHUP for them. Note that the patch does not fix not returning POLLHUP for fifos. PR: kern/94772 Submitted by: bde (original version) Reviewed by: rwatson, jilles Approved by: re (kensmith) MFC after: 6 weeks (might be)
* s/a_fdidx/a_fp/ for VOP_OPEN comments that inline struct vop_open_argskib2009-06-101-1/+1
| | | | | | | definition. Discussed with: bde MFC after: 2 weeks
* Remove unused VOP_IOCTL and VOP_KQFILTER implementations for fifofs.kib2009-06-101-40/+2
| | | | MFC after: 2 weeks
* Remove VOP_LEASE and supporting functions. This hasn't been used sincerwatson2009-04-101-1/+0
| | | | | | | | | | | | | | the removal of NQNFS, but was left in in case it was required for NFSv4. Since our new NFSv4 client and server can't use it for their requirements, GC the old mechanism, as well as other unused lease- related code and interfaces. Due to its impact on kernel programming and binary interfaces, this change should not be MFC'd. Proposed by: jeff Reviewed by: jeff Discussed with: rmacklem, zach loafman @ isilon
* Tweak the output of VOP_PRINT/vn_printf() some.jhb2009-02-061-0/+1
| | | | | | | | - Align the fifo output in fifo_print() with other vn_printf() output. - Remove the leading space from lockmgr_printinfo() so its output lines up in vn_printf(). - lockmgr_printinfo() now ends with a newline, so remove an extra newline from vn_printf().
* Assert an exclusive vnode lock for fifo_cleanup() and fifo_close() sincejhb2009-01-281-2/+2
| | | | | | they change v_fifoinfo. Discussed with: ups (a while ago)
* The kernel may do unbalanced calls to fifo_close() for fifo vnode,kib2009-01-261-1/+4
| | | | | | | | | | | | | without corresponding number of fifo_open(). This causes assertion failure in fifo_close() due to vp->v_fifoinfo being NULL for kernel with INVARIANTS, or NULL pointer dereference otherwise. In fact, we may ignore excess calls to fifo_close() without bad consequences. Turn KASSERT() into the return, and print warning for now. Tested by: pho Reviewed by: rwatson MFC after: 2 weeks
* Retire the MALLOC and FREE macros. They are an abomination unto style(9).des2008-10-231-2/+2
| | | | MFC after: 3 months
* Remove kernel support for M:N threading.jeff2008-03-121-1/+1
| | | | | | | | While the KSE project was quite successful in bringing threading to FreeBSD, the M:N approach taken by the kse library was never developed to its full potential. Backwards compatibility will be provided via libmap.conf for dynamically linked binaries and static binaries will be broken.
* Remove Giant acquisition around soreceive() and sosend() in fifofs. Therwatson2008-01-261-10/+4
| | | | | | | | | bug that caused us to reintroduce it is believed to be fixed, and Kris says he no longer sees problems with fifofs in highly parallel builds. If this works out, we'll MFC it for 7.1. MFC after: 3 months Pointed out by: kris
* VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used inattilio2008-01-131-2/+2
| | | | | | | | | | | conjuction with 'thread' argument passing which is always curthread. Remove the unuseful extra-argument and pass explicitly curthread to lower layer functions, when necessary. KPI results broken by this change, which should affect several ports, so version bumping and manpage update will be further committed. Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com>
* vn_lock() is currently only used with the 'curthread' passed as argument.attilio2008-01-101-2/+2
| | | | | | | | | | | | | | | | Remove this argument and pass curthread directly to underlying VOP_LOCK1() VFS method. This modify makes the code cleaner and in particular remove an annoying dependence helping next lockmgr() cleanup. KPI results, obviously, changed. Manpage and FreeBSD_version will be updated through further commits. As a side note, would be valuable to say that next commits will address a similar cleanup about VFS methods, in particular vop_lock1 and vop_unlock. Tested by: Diego Sardina <siarodx at gmail dot com>, Andrea Di Pasquale <whyx dot it at gmail dot com>
* Make ftruncate a 'struct file' operation rather than a vnode operation.jhb2008-01-071-0/+9
| | | | | | | | | | | | | | This makes it possible to support ftruncate() on non-vnode file types in the future. - 'struct fileops' grows a 'fo_truncate' method to handle an ftruncate() on a given file descriptor. - ftruncate() moves to kern/sys_generic.c and now just fetches a file object and invokes fo_truncate(). - The vnode-specific portions of ftruncate() move to vn_truncate() in vfs_vnops.c which implements fo_truncate() for vnode file types. - Non-vnode file types return EINVAL in their fo_truncate() method. Submitted by: rwatson
* Remove explicit locking of struct file.jeff2007-12-301-4/+1
| | | | | | | | | | | | | - Introduce a finit() which is used to initailize the fields of struct file in such a way that the ops vector is only valid after the data, type, and flags are valid. - Protect f_flag and f_count with atomic operations. - Remove the global list of all files and associated accounting. - Rewrite the unp garbage collection such that it no longer requires the global list of all files and instead uses a list of all unp sockets. - Mark sockets in the accept queue so we don't incorrectly gc them. Tested by: kris, pho
* When we do open, we should lock the vnode exclusively. This fixes few races:pjd2007-07-261-1/+1
| | | | | | | | | | - fifo race, where two threads assign v_fifoinfo, - v_writecount modifications, - v_object modifications, - and probably more... Discussed with: kib, ups Approved by: re (rwatson)
* Revert UF_OPENING workaround for CURRENT.kib2007-05-311-4/+3
| | | | | | | | | Change the VOP_OPEN(), vn_open() vnode operation and d_fdopen() cdev operation argument from being file descriptor index into the pointer to struct file. Proposed and reviewed by: jhb Reviewed by: daichi (unionfs) Approved by: re (kensmith)
* Replace custom file descriptor array sleep lock constructed using a mutexrwatson2007-04-041-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and flags with an sxlock. This leads to a significant and measurable performance improvement as a result of access to shared locking for frequent lookup operations, reduced general overhead, and reduced overhead in the event of contention. All of these are imported for threaded applications where simultaneous access to a shared file descriptor array occurs frequently. Kris has reported 2x-4x transaction rate improvements on 8-core MySQL benchmarks; smaller improvements can be expected for many workloads as a result of reduced overhead. - Generally eliminate the distinction between "fast" and regular acquisisition of the filedesc lock; the plan is that they will now all be fast. Change all locking instances to either shared or exclusive locks. - Correct a bug (pointed out by kib) in fdfree() where previously msleep() was called without the mutex held; sx_sleep() is now always called with the sxlock held exclusively. - Universally hold the struct file lock over changes to struct file, rather than the filedesc lock or no lock. Always update the f_ops field last. A further memory barrier is required here in the future (discussed with jhb). - Improve locking and reference management in linux_at(), which fails to properly acquire vnode references before using vnode pointers. Annotate improper use of vn_fullpath(), which will be replaced at a future date. In fcntl(), we conservatively acquire an exclusive lock, even though in some cases a shared lock may be sufficient, which should be revisited. The dropping of the filedesc lock in fdgrowtable() is no longer required as the sxlock can be held over the sleep operation; we should consider removing that (pointed out by attilio). Tested by: kris Discussed with: jhb, kris, attilio, jeff
* Change fifo_printinfo to check if the vnode v_fifoinfo pointermpp2007-03-021-0/+4
| | | | is NULL and print a message to that effect to prevent a panic.
* Add a_fdidx to comment prototype for fifo_open().rwatson2006-03-151-0/+1
| | | | | MFC after: 3 days Submitted by: Kostik Belousov <kostikbel at gmail dot com>
* If fifo_open() is called with a negative file descriptor, return EINVALrwatson2006-03-141-0/+2
| | | | | | | | | | | rather than panicking later. This can occur if the kernel calls vn_open() on a fifo, as there will be no associated file descriptor, and therefore the file descriptor operations cannot be modified to point to the fifo operation set. MFC after: 3 days Reported by: Martin <nakal at nurfuerspam dot de> PR: 94278
* Second attempt at a work-around for fifo-related socket panics duringrwatson2005-10-011-0/+4
| | | | | | | | make -j with high levels of parallelism: acquire Giant in fifo I/O routines. Discussed with: ups MFC after: 3 days
* Back out fifo_vnops.c:1.127, which introduced an sx lock around I/O onrwatson2005-09-271-16/+3
| | | | | | | | | a fifo. While this did indeed close the race, confirming suspicions about the nature of the problem, it causes difficulties with blocking I/O on fifos. Discussed with: ups Also spotted by: Peter Holm <peter at holm dot cc>
* Assert v_fifoinfo is non-NULL in fifo_close() in order to catchrwatson2005-09-261-0/+1
| | | | | | | non-conforming cases sooner. MFC after: 3 days Reported by: Peter Holm <peter at holm dot cc>
* Lock the read socket receive buffer when frobbing the sb_state flag onrwatson2005-09-251-2/+2
| | | | | | | | | that socket during open, not the write socket receive buffer. This might explain clearing of the sb_state SB_LOCK flag seen occasionally in soreceive() on fifos. MFC after: 3 days Spotted by: ups
* For reasons of consistency (and necessity), assert an exclusive vnoderwatson2005-09-231-0/+1
| | | | | | | lock on the fifo vnode in fifo_open(): we rely on the vnode lock to serialize access to v_fifoinfo. MFC after: 3 days
* Add fi_sx, an sx lock to serialize I/O operations on the socket pairrwatson2005-09-221-3/+16
| | | | | | | | | | | | | | | | | | | | underlying the POSIX fifo implementation. In 6.x/7.x, fifo access is moved from the VFS layer, where it was serialized using the vnode lock, to the file descriptor layer, where access is protected by a reference count but not serialized. This exposed socket buffer locking to high levels of parallelism in specific fifo workloads, such as make -j 32, which expose as yet unresolved socket buffer bugs. fi_sx re-adds serialization about the read and write routines, although not paths that simply test socket buffer mbuf queue state, such as the poll and kqueue methods. This restores the extra locking cost previously present in some cases, but is an effective workaround for the instability that has been experienced. This workaround should be removed once the bug in socket buffer handling has been fixed. Reported by: kris, jhb, Julien Gabel <jpeg at thilelli dot net>, Peter Holm <peter at holm dot cc>, others MFC after: 3 days
* Assert that (vp) is locked in fifo_close(), since we rely on therwatson2005-09-181-0/+1
| | | | | | | exclusive vnode lock to synchronize the reference counts on struct fifoinfo. MFC after: 3 days
* The socket pointers in fifoinfo are not permitted to be NULL, sorwatson2005-09-151-5/+2
| | | | | | don't check if they are, it just confuses the fifo code more. MFC after: 3 days
* Trim down now (believed to be) unused fifo_ioctl() andrwatson2005-09-131-65/+75
| | | | | | | | | | | | | | | | | | | | | | fifo_kqfilter() VOP implementations, since they in theory are used only on open file descriptors, in which case the ioctls are via fifo_ioctl_f() and kqueue requests are via fifo_kqfilter_f(). Generate warnings if they are entered for now. These printf() calls should become panic() calls. Annotate and re-implement fifo_ioctl_f(): don't arbitrarily forward ioctls to the socket layer, only forward the ones we explicitly support for fifos. In the case of FIONREAD, don't forward the request to the write socket on a read-write fifo, or the read result is overwritten. Annotate a nasty case for the undefined POSIX O_RDWR on fifos, in which failure of the second ioctl will result in the socket pair being in an inconsistent state. Assert copyright as I find myself rewriting non-trivial parts of fifofs. MFC after: 3 days
* As a result of kqueue locking work, socket buffer locks will alwaysrwatson2005-09-131-18/+6
| | | | | | | | be held when entering a kqueue filter for fifos via a socket buffer event: as such, assert the lock unconditionally rather than acquiring it conditionall. MFC after: 3 days
* Annotate two issues:rwatson2005-09-131-0/+12
| | | | | | | | | | | | 1) fifo_kqfilter() is not actually ever used, it likely should be GC'd. 2) fifo_kqfilter_f() doesn't implement EVFILT_VNODE, so detecting events on the underlying vnode for a fifo no longer works (it did in 4.x). Likely, fifo_kqfilter_f() should forward the request to the VFS using fp->f_vnode, which would work once fifo_kqfilter() was detached from the vnode operation vector (removing the fifo override). Discussed with: phk
* Introduce no-op nosup fifo kqueue filter and detach routine, which arerwatson2005-09-121-1/+33
| | | | | | | | | | | | | | | | used when a read filter is requested on a write-only fifo descriptor, or a write filter is requested on a read-only fifo descriptor. This permits the filters to be registered, but never raises the event, which causes kqueue behavior for fifos to more closely match similar semantics for poll and select, which permit testing for the condition even though the condition will never be raised, and is consistent with POSIX's notion that a fifo has identical semantics to a one-way IPC channel created using pipe() on most operating systems. The fifo regression test suite can now run to completion on HEAD without errors. MFC after: 3 days
* When a request is made to register a filter on a fifo that doesn'trwatson2005-09-121-2/+2
| | | | | | | apply to the fifo (i.e., not EVFILT_READ or EVFILT_WRITE), reject it as EINVAL, not by returning 1 (EPERM). MFC after: 3 days
* Remove DFLAG_SEEKABLE from fifo file descriptors: fifos are not seekablerwatson2005-09-121-1/+1
| | | | | | according to POSIX, not to mention the fact that it doesn't make sense (and hence isn't really implemented). This causes the fifo_misc regression test to succeed.
* Only poll the fifo for read events if the fifo is attached to a readablerwatson2005-09-121-2/+2
| | | | | | | | | | | | | | file descriptor. Otherwise, the read end of a fifo might return that it is writable (which it isn't). Only poll the fifo for write events if the fifo attached to a writable file descriptor. Otherwise, the write end of a fifo might return that it is readable (which it isn't). In the event that a file is FREAD|FWRITE (which is allowed by POSIX, but has undefined behavior), we poll for both. MFC after: 3 days
* After going to some trouble to identify only the write-related eventsrwatson2005-09-121-2/+2
| | | | | | | | | to poll the write socket for, the fifo polling code proceeded to poll for the complete set of events. Use 'levents' instead of 'events' as the argument to poll, and only poll the write socket if there is interest in write events. MFC after: 3 days
* When a writer opens a fifo, wake up the read socket for read, not therwatson2005-09-121-1/+1
| | | | | | write socket. MFC after: 3 days
* Add an assertion that fifo_open() doesn't race against other threadsrwatson2005-09-121-0/+2
| | | | | | | while sleeping to allocate fifo state: due to using the vnode lock to serialize access to a fifo during open, it shouldn't happen (tm). MFC after: 3 days
* Rather than reaching into the internals of the UNIX domain socket coderwatson2005-09-121-1/+1
| | | | | | | by calling uipc_connect2() to connect two socket endpoints to create a fifo, call soconnect2(). MFC after: 3 days
* - The VI_DOOMED flag now signals the end of a vnode's relationship withjeff2005-03-131-4/+0
| | | | | | | | the filesystem. Check that rather than VI_XLOCK. - VOP_INACTIVE should no longer drop the vnode lock. - The vnode lock is required around calls to vrecycle() and vgone(). Sponsored by: Isilon Systems, Inc.
* 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
|
OpenPOWER on IntegriCloud