Commit Graph

1529 Commits

Author SHA1 Message Date
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
mlelstv
8e1e9026ea At least fetch the mount data pointer before using it.
Coverity CID 274525
2013-12-25 11:11:55 +00:00
mlelstv
266e035aaa don't treat adjacent members as a larger array
Coverity CID 977367
2013-12-24 16:51:24 +00:00
hannken
7e0115bce6 It is not the task of sysvbfs_open() to check for unlinked nodes. 2013-12-24 09:56:18 +00:00
hannken
905b6b7730 It is not the task of tmpfs_open() to check for unlinked nodes.
Fix tmpfs_lookup() to always return ENOENT when looking up from
an unlinked directory.
2013-12-24 09:23:33 +00:00
christos
9c43792b5f CID 975205: Unchecked return value 2013-12-10 18:20:32 +00:00
wiz
d860f590d4 Fix typo ("then" instead of "than") 2013-12-09 09:35:16 +00:00
christos
9d605174d9 Change the queue.3 *_END(&head) macros to NULL. Since we don't have CIRCLEQ
anymore, all the macros expand to NULL anyway, so this improves readability.
Requested by rmind@
2013-11-27 17:24:43 +00:00
rmind
ccc45228d5 - tmpfs_construct_node: prevent from the new node construction if the
directory was removed.  Fixes the crash reported by Nicolas Joly.
- tmpfs_reclaim: avoid race by checking tn_links with the vnode locked.
2013-11-24 17:16:29 +00:00
rmind
63faa32f62 tmpfs_reg_resize: use size_t. 2013-11-23 21:53:27 +00:00
rmind
b05b03890a Fix previous, add __diagused. 2013-11-23 17:01:07 +00:00
rmind
e63cf28e67 - Simplify tmpfs_update(), eliminate tmpfs_note_t::tn_status and deferred
timestamp updates.  Fix some incorrect updates and plug some missing ones.
  Should fix PR/48385.
- tmpfs_rmdir: avoid O(n) scan when the directory is not empty and whiteout
  entries were never added.
2013-11-23 16:35:32 +00:00
christos
0b725b63c7 change the mountlist CIRCLEQ into a TAILQ 2013-11-23 13:35:36 +00:00
riz
1000f7c1af Don't create a variable just to assert() on it - assert on the
thing the variable got assigned.
2013-11-21 23:42:09 +00:00
rmind
ace15189ad tmpfs_dir_getdotents: fix the recent regression, set the correct
d_fileno value for dot-dot.  Spotted by Pedro Martelletto, thanks!
2013-11-21 14:39:09 +00:00
rmind
884c21d51e v7fs: replace malloc(9) with kmem(9), fix a memory leak and few missing
mutex destruction cases in the error path.
2013-11-20 23:44:23 +00:00
rmind
8da90206bc Make tmpfs_node_t::tn_gen a 32-bit number, keep it in sync with tmpfs_fid_t.
Also, change tn_status to unsigned while here.
2013-11-18 01:39:34 +00:00
rmind
3033c7dc60 tmpfs_dir_getdents: avoid leaking kernel memory to the userspace.
From Pedro Martelletto.

XXX: regress/sys/fs/getdents should be a part of the test suite
2013-11-16 17:58:27 +00:00
rmind
6862603939 tmpfs_alloc_node: use cprng_fast64(), the old random(9) shall be removed. 2013-11-11 17:04:06 +00:00
rmind
89433ee6d9 Handle whiteout case in tmpfs_dir_detach() and tmpfs_unmount(). 2013-11-10 12:46:19 +00:00
christos
15bc40ee73 mark variable __diagused 2013-11-10 03:20:20 +00:00
rmind
1f5dbc945b tmpfs: replace the broken tmpfs_dircookie() logic which uses the node
address truncated to 31 bits (required for 32-bit readdir compatibility,
e.g. linux32).  Instead, assign 2^31 range using the following logic:
- The first half of the 2^31 is assigned incrementally (the fast path).
- When exceeded, use the second half of 2^31, but manage with vmem(9).

It will require 2 billion files per-directory to trigger vmem(9) usage.
Also, while here, add some fixes for tmpfs_unmount().

Should fix PR/47739, PR/47480, PR/46088 and PR/41068.
Thanks to wiz@ for stress testing.
2013-11-08 15:44:23 +00:00
christos
1aaac765ed - support advisory locking on ptys
- get the link count correct for .
XXX: pullup 6
2013-11-05 00:40:33 +00:00
hannken
690094cb2d Stop using v_mount of an unreferenced vnode -- save the mount while
the vnode has a reference.
2013-11-02 10:30:18 +00:00
rmind
20a51a9773 tmpfs: fix the zero-length symlink target case as NetBSD supports them. 2013-11-01 15:38:45 +00:00
mrg
c77065c11b apply __diagused where appropriate. 2013-11-01 06:41:56 +00:00
rmind
f8abe6cb77 tmpfs_alloc_node: it is less error-prone to store the link path with
the NIL terminator included.  Adjust tmpfs_readlink() to exclude NIL.
Also, remove the check for zero-length and add some asserts.
2013-10-31 00:59:17 +00:00
mrg
4cf2909a7b used __diagused where appropriate. 2013-10-30 08:41:38 +00:00
mrg
cb7e28b713 use __diagused where appropriate. 2013-10-30 08:27:01 +00:00
christos
0d211931ed fix unused variable warnings 2013-10-20 21:13:15 +00:00
christos
cb2fa8e0d7 Now that KASSERT will always consume its arguments, move a KASSERT inside
a DIAGNOSTIC, because the function used is only defined with DIAGNOSTIC.
2013-10-20 21:12:08 +00:00
christos
59f2a2f5c4 remove unused 2013-10-20 17:14:48 +00:00
christos
de0d394bfe provide a function to access the name and extension as a single array as
opposed depend on array index overflow.
2013-10-20 00:01:55 +00:00