summaryrefslogtreecommitdiffstats
path: root/sys/fs/pseudofs
Commit message (Collapse)AuthorAgeFilesLines
* Do not perform unneccessary shared recursion on the allproc_lock inkib2016-03-111-10/+12
| | | | | | | | | | | | | pfs_visible(). The recursion does not cause deadlock because the sx implementation does not prefer exclusive waiters over the shared, but this is an implementation detail. Reported by: pho, Matthew Bryan <matthew.bryan@isilon.com> Reviewed by: jhb Tested by: pho Approved by: des (pseudofs maintainer) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* Hide vfs.pfs.trace variable if it is not used.dchagin2015-05-241-0/+2
|
* Redo r258088 to avoid relying on signed arithmetic overflow, sincekib2013-11-201-9/+4
| | | | | | | | | | | | compiler interprets this as an undefined behaviour. Instead, ensure that the sum of uio_offset and uio_resid is below OFF_MAX using the operation which cannot overflow. Reported and tested by: pho Discussed with: bde Approved by: des (pseudofs maintainer) Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Remove useless comparisions of assigned offset and resid with thekib2013-11-131-4/+6
| | | | | | | | | | | | | sources from uio. Both uio_offset and offset, and uio_resid and resid have the same types for some time. Add check for buflen overflow by comparing the buflen with both offset and resid (vs. comparing with offset only, as it is currently done). Reported and tested by: pho Approved by: des (pseudofs maintainer) Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Complete MPSAFE VFS interface and remove MNTK_MPSAFE flag.attilio2012-11-091-1/+0
| | | | | Porters should refer to __FreeBSD_version 1000021 for this change as it may have happened at the same timeframe.
* Apply inlined vn_vget_ino() algorithm for ".." lookup in pseudofs.kib2012-03-051-5/+32
| | | | | Reported and tested by: pho MFC after: 2 weeks
* Add procfs to jail-mountable filesystems.mm2012-02-291-2/+6
| | | | | Reviewed by: jamie MFC after: 1 week
* Fix found places where uio_resid is truncated to int.kib2012-02-211-1/+2
| | | | | | | | | Add the sysctl debug.iosize_max_clamp, enabled by default. Setting the sysctl to zero allows to perform the SSIZE_MAX-sized i/o requests from the usermode. Discussed with: bde, das (previous versions) MFC after: 1 month
* Make sure all intermediate variables holding mount flags (mnt_flag)mckusick2012-01-172-2/+2
| | | | | | | and that all internal kernel calls passing mount flags are declared as uint64_t so that flags in the top 32-bits are not lost. MFC after: 2 weeks
* Convert files to UTF-8uqs2012-01-156-6/+6
|
* r222004 changed sbuf_finish() to not clear the buffer error status. As ajh2012-01-061-6/+12
| | | | | | | | | | | | | | | consequence sbuf_len() will return -1 for buffers which had the error status set prior to sbuf_finish() call. This causes a problem in pfs_read() which purposely uses a fixed size sbuf to discard bytes which are not needed to fulfill the read request. Work around the problem by using the full buffer length when sbuf_finish() indicates an overflow. An overflowed sbuf with fixed size is always full. PR: kern/163076 Approved by: des MFC after: 2 weeks
* Check the return value of sbuf_finish() in pfs_readlink() and returnjh2012-01-061-1/+5
| | | | | | | ENAMETOOLONG if the buffer overflowed. Approved by: des MFC after: 2 weeks
* Existing VOP_VPTOCNP() interface has a fatal flow that is critical forkib2011-11-191-2/+1
| | | | | | | | | | | | | | | | | | | | | nullfs. The problem is that resulting vnode is only required to be held on return from the successfull call to vop, instead of being referenced. Nullfs VOP_INACTIVE() method reclaims the vnode, which in combination with the VOP_VPTOCNP() interface means that the directory vnode returned from VOP_VPTOCNP() is reclaimed in advance, causing vn_fullpath() to error with EBADF or like. Change the interface for VOP_VPTOCNP(), now the dvp must be referenced. Convert all in-tree implementations of VOP_VPTOCNP(), which is trivial, because vhold(9) and vref(9) are similar in the locking prerequisites. Out-of-tree fs implementation of VOP_VPTOCNP(), if any, should have no trouble with the fix. Tested by: pho Reviewed by: mckusick MFC after: 3 weeks (subject of re approval)
* Fix build, use %d for int value formatting.kib2011-11-161-1/+1
|
* Handle invalid large values for getdirentries(2) data buffer size.pho2011-11-161-22/+35
| | | | | | | In collaboration with: kib Reviewed by: des Reported by: The iknowthis syscall fuzzer. MFC after: 1 week
* Removed extra PRELE() call.pho2011-11-151-2/+0
| | | | MFC after: 1 week
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.ed2011-11-071-1/+1
| | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
* Add dedicated routines to toggle lockmgr flags such as LK_NOSHARE andjhb2010-08-201-1/+1
| | | | | | | | | | | | LK_CANRECURSE after a lock is created. Use them to implement macros that otherwise manipulated the flags directly. Assert that the associated lockmgr lock is exclusively locked by the current thread when manipulating these flags to ensure the flag updates are safe. This last change required some minor shuffling in a few filesystems to exclusively lock a brand new vnode slightly earlier. Reviewed by: kib MFC after: 3 days
* The cache_enter(9) function shall not be called for doomed dvp.kib2010-04-201-1/+1
| | | | | | | | | | | | | | | | Assert this. In the reported panic, vdestroy() fired the assertion "vp has namecache for ..", because pseudofs may end up doing cache_enter() with reclaimed dvp, after dotdot lookup temporary unlocked dvp. Similar problem exists in ufs_lookup() for "." lookup, when vnode lock needs to be upgraded. Verify that dvp is not reclaimed before calling cache_enter(). Reported and tested by: pho Reviewed by: kan MFC after: 2 weeks
* Truncate read request rather than returning EIO if the request isjh2010-01-221-4/+2
| | | | | | | | | | larger than MAXPHYS + 1. This fixes a problem with cat(1) when it uses a large I/O buffer. Reported by: Fernando ApesteguĂ­a Suggested by: jilles Reviewed by: des Approved by: trasz (mentor)
* If a race is detected, pfs_vncache_alloc() may reclaim a vnode that hadkib2009-09-071-3/+5
| | | | | | | | | | | | | | | | never been inserted into the pfs_vncache list. Since pfs_vncache_free() does not anticipate this case, it decrements pfs_vncache_entries unconditionally; if the vnode was not in the list, pfs_vncache_entries will no longer reflect the actual number of list entries. This may cause size of the cache to exceed the configured maximum. It may also trigger a panic during module unload or system shutdown. Do not decrement pfs_vncache_entries for the vnode that was not in the list. Submitted by: tegge Reviewed by: des MFC after: 1 week
* insmntque_stddtr() clears vp->v_data and resets vp->v_op tokib2009-09-071-0/+1
| | | | | | | | | dead_vnodeops before calling vgone(). Revert r189706 and corresponding part of the r186560. Noted and reviewed by: tegge Approved by: des (pseudofs part) MFC after: 3 days
* Remove spurious pfs_unlock().kib2009-08-311-1/+0
| | | | | | PR: kern/137310 Reviewed by: des MFC after: 3 days
* Change the type of uio_resid member of struct uio from int to ssize_t.kib2009-06-251-2/+2
| | | | | | | | Note that this does not actually enable full-range i/o requests for 64 architectures, and is done now to update KBI only. Tested by: pho Reviewed by: jhb, bde (as part of the review of the bigger patch)
* VOP_IOCTL takes unlocked vnode as an argument. Due to this, v_data maykib2009-06-101-6/+22
| | | | | | | | | | | | be NULL or derefenced memory may become free at arbitrary moment. Lock the vnode in cd9660, devfs and pseudofs implementation of VOP_IOCTL to prevent reclaim; check whether the vnode was already reclaimed after the lock is granted. Reported by: georg at dts su Reviewed by: des (pseudofs) MFC after: 2 weeks
* Drop Giant.des2009-06-061-12/+14
| | | | MFC after: 1 week
* Unlock the pseudofs vnode before calling fill method for pfs_readlink().kib2009-05-311-1/+6
| | | | | | | | | The fill code may need to lock another vnode, e.g. procfs file implementation. Reviewed by: des Tested by: pho MFC after: 2 weeks
* Use a temporary variable to avoid a duplicate strlen().des2009-05-281-2/+3
| | | | | Submitted by: kib MFC after: 1 week
* Remove the thread argument from the FSD (File-System Dependent) parts ofattilio2009-05-112-17/+14
| | | | | | | | | | | | | | | | | the VFS. Now all the VFS_* functions and relating parts don't want the context as long as it always refers to curthread. In some points, in particular when dealing with VOPs and functions living in the same namespace (eg. vflush) which still need to be converted, pass curthread explicitly in order to retain the old behaviour. Such loose ends will be fixed ASAP. While here fix a bug: now, UFS_EXTATTR can be compiled alone without the UFS_EXTATTR_AUTOSTART option. VFS KPI is heavilly changed by this commit so thirdy parts modules needs to be recompiled. Bump __FreeBSD_version in order to signal such situation.
* Remove spurious locking in pfs_write().des2009-04-081-2/+0
| | | | | Reported by: Andrew Brampton <me@bramp.net> MFC after: 1 week
* Fix an inverted KASSERT. Add similar assertions in other similar places.des2009-04-071-2/+20
| | | | | Reported by: Andrew Brampton <me@bramp.net> MFC after: 1 week
* Fix a logic bug that caused the pfs_attr method to be called only fordes2009-02-161-3/+6
| | | | | | | PFS_PROCDEP nodes. Submitted by: Andrew Brampton <brampton@gmail.com> MFC after: 2 weeks
* Fix a deadlock which can occur due to a pseudofs vnode not getting unlocked.marcus2009-01-091-0/+1
| | | | | | Reported by: Richard Todd <rmtodd@ichotolot.servalan.com> Reviewed by: kib Approved by: kib
* Add a VOP_VPTOCNP implementation for pseudofs which covers file systemsmarcus2008-12-301-0/+79
| | | | | | | | | | | | such as procfs and linprocfs. This implementation's locking was enhanced by kib. Reviewed by: kib des Approved by: des kib Tested by: pho
* When the insmntque() in the pfs_vncache_alloc() fails, vop_reclaim callskib2008-12-291-1/+2
| | | | | | | | | | | | pfs_vncache_free() that removes pvd from the list, while it is not yet put on the list. Prevent the invalid removal from the list by clearing pvd_next and pvd_prev for the newly allocated pvd, and only move pfs_vncache list head when the pvd was at the head. Suggested and approved by: des MFC after: 2 weeks
* Drop the pseudofs vnode lock around call to pfs_read handler. The handlerkib2008-12-291-15/+18
| | | | | | | | | may need to lock arbitrary vnodes, causing either lock order reversal or recursive vnode lock acquisition. Tested by: pho Approved by: des MFC after: 2 weeks
* After the pfs_vncache_mutex is dropped, another thread may attempt tokib2008-12-291-13/+26
| | | | | | | | | | | | | | | | | | do pfs_vncache_alloc() for the same pfs_node and pid. In this case, we could end up with two vnodes for the pair. Recheck the cache under the locked pfs_vncache_mutex after all sleeping operations are done [1]. This case mostly cannot happen now because pseudofs uses exclusive vnode locking for lookup. But it does drop the vnode lock for dotdot lookups, and Marcus' pseudofs_vptocnp implementation is vulnerable too. Do not call free() on the struct pfs_vdata after insmntque() failure, because vp->v_data points to the structure, and pseudofs_reclaim() frees it by the call to pfs_vncache_free(). Tested by: pho [1] Approved by: des MFC after: 2 weeks
* Introduce accmode_t. This is required for NFSv4 ACLs - it will be neccessarytrasz2008-10-281-1/+1
| | | | | | | to add more V* constants, and the variables changed by this patch were often being assigned to mode_t variables, which is 16 bit. Approved by: rwatson (mentor)
* Retire the MALLOC and FREE macros. They are an abomination unto style(9).des2008-10-232-6/+6
| | | | MFC after: 3 months
* fdescfs, devfs, mqueuefs, nfs, portalfs, pseudofs, tmpfs and xfskib2008-09-201-1/+1
| | | | | | | | | | | initialize the vattr structure in VOP_GETATTR() with VATTR_NULL(), vattr_null() or by zeroing it. Remove these to allow preinitialization of fields work in vn_stat(). This is needed to get birthtime initialized correctly. Submitted by: Jaakko Heinonen <jh saunalahti fi> Discussed on: freebsd-fs MFC after: 1 month
* Decontextualize the couplet VOP_GETATTR / VOP_SETATTR as the passed threadattilio2008-08-281-2/+2
| | | | | | was always curthread and totally unuseful. Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
* Introduce some functions in the vnode locks namespace and in the ffsattilio2008-02-241-1/+1
| | | | | | | | | | | | | | | namespace in order to handle lockmgr fields in a controlled way instead than spreading all around bogus stubs: - VN_LOCK_AREC() allows lock recursion for a specified vnode - VN_LOCK_ASHARE() allows lock sharing for a specified vnode In FFS land: - BUF_AREC() allows lock recursion for a specified buffer lock - BUF_NOREC() disallows recursion for a specified buffer lock Side note: union_subr.c::unionfs_node_update() is the only other function directly handling lockmgr fields. As this is not simple to fix, it has been left behind as "sole" exception.
* VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used inattilio2008-01-132-3/+3
| | | | | | | | | | | 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-102-3/+3
| | | | | | | | | | | | | | | | 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>
* Get rid of qaddr_t.alfred2007-10-161-1/+1
| | | | Requested by: bde
* Use the correct pid when checking to see whether or not the /proc/<pid>jhb2007-10-051-1/+1
| | | | | | | | | | directory itself (rather than any of its contents) is visible to the current thread. MFC after: 1 week PR: kern/90063 Submitted by: john of 8192.net Approved by: re (kensmith)
* Fix off-by-one error (introduced in r1.60) that had the effect ofbmah2007-06-071-1/+1
| | | | | | | | disallowing a read of exactly MAXPHYS bytes. Reviewed by: des, rdivacky MFC after: 1 week Sponsored by: nCircle Network Security
* Fix old locking bugs which were revealed when pseudofs was made MPSAFE.des2007-04-231-1/+9
| | | | Submitted by: tegge
* Avoid "unused variable" warning when building without PSEUDOFS_TRACE.des2007-04-151-0/+1
|
* Make pseudofs (and consequently procfs, linprocfs and linsysfs) MPSAFE.des2007-04-156-340/+553
|
OpenPOWER on IntegriCloud