Commit Graph

1561 Commits

Author SHA1 Message Date
hannken de57916f59 msdosfs_reclaim(): add missing fstrans and protect change
of v_data with v_interlock as msdosfs_sync() now needs it.
2014-05-30 08:42:35 +00:00
rmind ce079fc9c0 tmpfs_mknod: it is not our responsibility to call vput() on the directory
vnode, so remove it (and ensure *vpp is NULL while here).
2014-05-26 19:12:07 +00:00
christos 202570e1e0 use macro. 2014-05-25 19:33:28 +00:00
christos 50f00297b4 use standard dirty vnode test. 2014-05-25 19:32:36 +00:00
hannken e03668ca99 The pageflush_selector gets a vnode with v_interlock held.
Remove the mutex_enter()/mutex_exit() and simplify.

Hi christos...
2014-05-25 17:43:47 +00:00
christos 02cb0c6eaf Introduce a selector function to the vfs vnode iterator so that we don't
need to vget() vnodes that we are not interested at, and optimize locking
a bit. Iterator changes reviewed by Hannken (thanks), the rest of the bugs
are mine.
2014-05-24 16:34:03 +00:00
dholland 8e1257d82c Also set or assert that *vpp is null before calling VOP_MKDIR. 2014-05-17 04:07:15 +00:00
dholland 3955d2067a Set *vpp to NULL before calling VOP_CREATE. This always happens when
calling using nameidata, and if not something went wrong, so we'd like
to be able to assert about it.
2014-05-17 04:03:49 +00:00
martin 3638eee882 PR kern/48799: make filehandles properly use 64bit inodes on CD9660 file
systems. Patch from Thomas Schmitt, with slight modifications.
2014-05-13 17:05:26 +00:00
martin b31205ebbb PR kern/48787: inode calculation from ISO9660 block offset might get
truncated to 32bit - force the whole expression to be evaluated as ino_t.
Patch from Thomas Schmitt, with minor modifications (and reworded comment).
2014-05-10 14:11:58 +00:00
christos 71fd41685f fix typo 2014-04-30 01:59:30 +00:00
christos 0172bc970f handle MNT_UPDATE 2014-04-30 01:33:51 +00:00
pooka 45fe388485 Don't lock an already locked vnode. 2014-04-25 15:18:06 +00:00
maxv 23f76b6d00 An (un)privileged user can easily make the kernel dereference a NULL
pointer.

The kernel allows 'data' to be NULL; it's the fs's responsibility to
ensure that it isn't NULL (if the fs actually needs data).

ok christos@
2014-04-16 18:55:17 +00:00
jakllsch 6d9f89fe00 Use size_t instead of int for character count to avoid sign compare issues. 2014-04-06 19:25:22 +00:00
christos c636575468 Handle multiple ptyfs mounts with different chroots. ptys opened in one
chroot are only visible in that chroot.
2014-04-04 18:10:29 +00:00
christos 4d87c37c1f forgot to commit one patch:
Avoid returning released(free), but still hashed inode numbers.
(Ilya Zykov)
2014-03-27 21:13:06 +00:00
christos a9253db65e From Ilya Zykov:
- ifdef out some code that is only used for NO_DEV_PTM
- pass the mountpoint instead of the ptm structure to the implementation
  dependent (ptyfs or bsdpty) functions.
- add a function to return the correct ptyfs mountpoint for the current lwp
2014-03-27 17:31:56 +00:00
christos 9b453fe1d0 if one of the ptyfs instances has grabbed the handle don't grab it again,
Ilya Zykov
2014-03-26 21:28:48 +00:00
christos 66873a203c kill sprintf. 2014-03-25 16:30:28 +00:00
hannken f3cf481632 - Make VI_XLOCK, VI_CLEAN and VI_LOCKSHARE private to kern/vfs_*.c.
- Make vwait() static.
- Add  vdead_check() to check a vnode for being or becoming dead.

Discussed on tech-kern.

Welcome to 6.99.38
2014-03-24 13:42:40 +00:00
dholland 37ec3a866f Tidy up locking in cd9660_mount; thrash the lock less, and make it
clear that the lock is only dropped when calling iso_mountfs().

While here, don't use the vnode pointer's value after vrele().
2014-03-24 04:03:25 +00:00
hannken 6d285189fb Change all vfsops to use C99 designated initializers.
No functional changes intended.
2014-03-23 15:21:15 +00:00
christos 0f18888b15 fix unused 2014-03-23 09:30:59 +00:00
christos 74758fe57e Ilya Zykov: Prepare readdir for multi-mountpoint use 2014-03-21 17:21:53 +00:00
christos bf11f52a36 - return an error if we could not get the pts pathname
- correct getting pathname if the mount point inside a chroot
(Ilya Zykov)
2014-03-19 18:09:00 +00:00
hannken fcb1d82829 Change smbfs_sync() to use vfs_vnode_iterator. 2014-03-17 09:37:09 +00:00
hannken f9d8c5c8e8 Change pageflush() to use vfs_vnode_iterator. 2014-03-17 09:36:34 +00:00
hannken b1e067f299 Change msdosfs_sync() to use vfs_vnode_iterator. 2014-03-17 09:35:59 +00:00
hannken 5e8d36ac30 Restructure union_lock() to always lock before testing for dead node.
Add two little helpers to lock or unlock a node.  Use "vp" for the
union node and "lockvp" for the node to be locked.  Use ISSET() to
test flags, add assertions.
2014-03-12 09:40:05 +00:00
hannken 2b6ec89863 The current implementation of vn_lock() is racy. Modification of
the vnode operations vector for active vnodes is unsafe because it
is not known whether deadfs or the original file system will be
called.

- Pass down LK_RETRY to the lock operation (hint for deadfs only).

- Change deadfs lock operation to return ENOENT if LK_RETRY is unset.

- Change all other lock operations to check for dead vnode once
  the vnode is locked and unlock and return ENOENT in this case.

With these changes in place vnode lock operations will never succeed
after vclean() has marked the vnode as VI_XLOCK and before vclean()
has changed the operations vector.

Adresses PR kern/37706 (Forced unmount of file systems is unsafe)

Discussed on tech-kern.

Welcome to 6.99.33
2014-02-27 16:51:37 +00:00
pooka 4f6fb3bf35 Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
2014-02-25 18:30:08 +00:00
maxv 1036f1d9fc Adapt my previous patch differently. read(2) wants EISDIR when the
object is a directory. Which also means that tmpfs_read() was returning
a wrong error code when dealing with non-regular vnodes.
2014-02-17 20:16:52 +00:00
maxv 6b47753f22 Fix tmpfs_read()'s return value; it should return EINVAL. Now consistent with
tmpfs_write().

ok christos@
2014-02-16 12:54:07 +00:00
hannken c36eeb723b Change union_allocvp() to take an unlocked uppervp and to return the
union node unlocked.  Another VI_XLOCK hack is gone.
2014-02-16 09:50:25 +00:00
hannken 32bc55a7e7 Member un_flags is unused now -- remove. 2014-02-14 08:50:27 +00:00
martin 478bc1f91d Remove an unused variable 2014-02-13 21:05:26 +00:00
hannken 8757071efb Get rid of UN_KLOCK to keep a lock on vput(). It is not really needed
and makes the source difficult to read.  Always hold references to the
union nodes until the operation is done.
2014-02-13 09:55:04 +00:00
hannken 15a20e1e67 Fix the DOT and DOTDOT case for union_lookup1(). 2014-02-13 09:50:31 +00:00
hannken 97834f7ba0 Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@

Welcome to 6.99.31
2014-02-07 15:29:20 +00:00
hannken b9c5e8c0f7 Remove an annoying printf. And to answer the question: VFS_VGET() gets
used by NFS V3 server for readdirplus.
2014-02-06 16:18:38 +00:00
martin dfd92bb472 Bogus gcc 4.8 maybe use uninitialized warning 2014-01-28 13:23:49 +00:00
hannken 04c776e5c8 Change vnode operations create, mknod, mkdir and symlink to return
the resulting vnode *vpp unlocked.

Discussed on tech-kern@

Welcome to 6.99.30
2014-01-23 10:13:55 +00:00
hannken 1139274440 Change vnode operations create, mknod, mkdir and symlink to keep the
directory node dvp locked on return.

Discussed on tech-kern@

Welcome to 6.99.29
2014-01-17 10:55:01 +00:00
pedro 65d0f0003c Prevent a diagnostic assertion in tmpfs_rmdir() from being triggered
through an rmdir on ".." by moving it so it happens after the check for
empty directories; OK rmind@.
2014-01-10 16:42:38 +00:00
hannken 9cd2f4b930 Operation sysvbfs_remove() destructs inodes attached to active vnodes.
Defer the destruction to sysvbfs_reclaim().

Disable test t_renamerace:sysvbfs_renamerace as it will exhaust the
inode table (sysvbfs has space for 8 inodes only).

Ok: Izumi Tsutsui <tsutsui@netbsd.org>
2014-01-09 13:23:57 +00:00
pedro 0cc071bd88 Allocate direntp on the stack in tmpfs_dir_getdents(), thus saving
calls to kmem_zalloc() and kmem_free(); OK rmind@. From OpenBSD.
2014-01-08 16:11:04 +00:00
hannken b04f8aa83f Fix a race where thread1 runs VOP_REMOVE() and gets preempted in
tmpfs_reclaim() before the call to tmpfs_free_node().  Thread2
runs VFS_FHTOVP() and gets a new vnode attached to the node thread1
is about to destroy.

Change tmpfs_fhtovp() to check the generation number after
tmpfs_vnode_get() succeeded.
2014-01-04 12:36:49 +00:00
hannken 8ea5485de5 Fix a race where thread1 runs VOP_REMOVE() and gets preempted in
tmpfs_reclaim() before the call to tmpfs_free_node().  Thread2
runs VFS_FHTOVP() and gets a new vnode attached to the node thread1
is about to destroy.

Change tmpfs_alloc_node() to always assign non-zero generation number
and tmpfs_inactive() to set the generation number of unlinked nodes
to zero.
2014-01-03 09:53:12 +00:00
mlelstv d4e64f4071 At least fetch mount data pointer before using it.
Coverity CID 274767
2013-12-25 11:15:49 +00:00