Commit Graph

355 Commits

Author SHA1 Message Date
hannken 5985f10515 No need to call vflush from failing udf_mount(). If the system nodes
really have to disappear we should change vrele() to vrecycle() here.
2017-06-24 12:13:16 +00:00
riastradh 93562e3f53 Eliminate crusty debugging sludge.
We have a mostly sane vnode lifecycle now.  If this needs debugging,
it should be done once at the call site of VOP_RECLAIM.
2017-05-26 14:34:19 +00:00
riastradh 7f7aad09bd Make VOP_RECLAIM do the last unlock of the vnode.
VOP_RECLAIM naturally has exclusive access to the vnode, so having it
locked on entry is not strictly necessary -- but it means if there
are any final operations that must be done on the vnode, such as
ffs_update, requiring exclusive access to it, we can now kassert that
the vnode is locked in those operations.

We can't just have the caller release the last lock because some file
systems don't use genfs_lock, and require the vnode to remain valid
for VOP_UNLOCK to work, notably unionfs.
2017-05-26 14:20:59 +00:00
riastradh 6fa7b15833 Change VOP_REMOVE and VOP_RMDIR to preserve lock/ref on dvp.
No change to vp -- the plan is to replace the node by the
componentname in the vop parameters, and let all directory vops do
lookups internally.

Proposed on tech-kern with no objections:
https://mail-index.netbsd.org/tech-kern/2017/04/17/msg021825.html
2017-04-26 03:02:47 +00:00
riastradh 87fb32292e Make VOP_INACTIVE preserve vnode lock on return.
Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2017/04/01/msg021751.html

Ride 7.99.68, a bumpy bus of incremental vfs improvements!
2017-04-11 14:24:59 +00:00
riastradh 30509f8074 KASSERT(mutex_owned(vp->v_interlock)) in vnode iterator selector. 2017-04-01 19:35:56 +00:00
hannken 326db3aaf6 Add generic genfs_suspendctl() and use it for all file systems.
Layered file systems need work.
2017-02-17 08:31:23 +00:00
christos 4faed551bb PR/51777: David Binderman: Remove unused computation 2017-01-04 15:53:14 +00:00
hannken 7139aab724 Remove now obsolete operation vcache_remove().
Welcome to 7.99.36
2016-08-20 12:37:06 +00:00
msaitoh 8bc54e5be6 KNF. Remove extra spaces. No functional change. 2016-07-07 06:55:38 +00:00
reinoud 42866dd28d Cleanup VAT writout. To prevent issues with the sequential writing strategy
trying to write on blocks that are lost due to the synchronisation, don't just
bluntly do synchronize device caches, but split out on strategies.
2016-05-24 09:55:57 +00:00
reinoud 46e9cd4dbd Rework VAT searching on recordable media. It is now a lot more resilliant to
errors and it allows for VAT searching on crashed writeouts.

While here, make sure the node pointer is always initialised in
udf_get_node().
2016-05-10 15:23:39 +00:00
christos d384368fae It is meaningless to check the root node if there was an error. 2016-01-29 10:42:30 +00:00
reinoud 7f3b83e2df Fix filename creation and deleting with illegal file names. UDF has a
machanism for it but it allowed to create a file with a name it considered
illegal that then couldn't be deleted with the same name.

Fixes PR kern/50608. When confirmed, it can be closed.
2016-01-27 00:06:49 +00:00
dholland 4caea7fde8 Improve misleading variable name. Related to PR 50571.
XXX: also there should be real bounds-check logic in here.
XXX: if the on-disk data structure contains rubbish this code will
XXX: leak or trample arbitrary kernel memory.
2015-12-19 03:16:09 +00:00
christos e26a1063f5 add missing , 2015-12-19 01:51:42 +00:00
christos 014d2807e0 PR/50571: David Binderman: src/sys/fs/udf/udf_subr.c:6465: obvious
performance tidyup
2015-12-19 01:18:00 +00:00
hannken 6495f9c3ba Remove dubious vhold()/holdrele() from write_logvol_dscr strategies.
The udf_node already gets locked with UDF_LOCK_NODE() and udf_reclaim()
will wait for the lock to clear.
2015-10-06 08:57:34 +00:00
christos 9ef18f76ff diagused some variables. 2015-09-12 19:50:08 +00:00
christos c82c3049c6 remove identity assignment, found by brainy. 2015-09-12 19:33:03 +00:00
hannken 4207afb71b Use vfs_vnode_iterator for udf_do_sync.
- Build rb_tree to get an ordered list of nodes, sync them and
  clean the tree.

- Stop abusing mntvnode_lock to serialize udf_do_sync, use new
  mutex ump->sync_lock instead.
2015-08-24 08:31:56 +00:00
hannken f731f08d1c Use vfs_vnode_iterator for udf_unmount_sanity_check. 2015-08-24 08:30:52 +00:00
hannken 09f7c2773a Remove dirtynodes_cv, it is only used for timed waits without any signals.
Replace the cv_timedwait with kpause.
2015-08-24 08:30:17 +00:00
riastradh 46e71c7d57 Make VOP_LINK return directory still locked and referenced.
Ride 7.99.10 bump.
2015-04-20 22:59:19 +00:00
riastradh f6139440c5 Make vget always return vnode unlocked.
Convert callers who want locks to use vn_lock afterward.

Add extra argument so the compiler will report stragglers.
2015-04-20 13:44:16 +00:00
hannken a494ee15b8 Change udf to vcache, keyed on udf_node->loc.loc. 2015-04-06 08:39:23 +00:00
hannken 94abdca3c1 Move the removal of unlinked nodes from udf_inactive() to udf_reclaim(). 2015-04-06 08:38:25 +00:00
riastradh a26f29c67f Fix remaining read(fd, NULL, 1) cases. 2015-04-04 12:34:44 +00:00
christos aa2ab5b195 fix udf_node leak. Reported by:
http://www.m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html#Report-4
2015-02-07 04:18:03 +00:00
martin acbabd6a6a When udf_symlink() fails, do not explicitly call udf_delete_node(), as
vrele() called next will do that again - avoids a double free of the
bitmap, leading to a KASSERT failure (or worse in real life) in the
udf_symlink_long in the fs/vfs::t_vnops test.
2015-01-28 14:00:58 +00:00
reinoud 5d76927e7e Add missing vrele() as found by the testsuite.
Thanks Jurgen Hannken for the patch.
2015-01-04 14:23:37 +00:00
reinoud 65b5af65e0 Explicitly delete the failing node; it would be killed with the unlink too but
explicitly deleting it is better than just setting the file size to zero.
2014-12-03 21:37:55 +00:00
reinoud a2b485ee86 Relax the KASSERT since an equal size is no issue 2014-12-03 21:34:55 +00:00
riz 28fe942ff2 Revert previous, it is actually needed. (builds are failing) 2014-11-10 19:44:08 +00:00
maxv fcc99ce60e Do not uselessly include <sys/malloc.h>. 2014-11-10 18:46:33 +00:00
uebayasi fe9a32c84e Define filesystem attributes with vfs dependency. 2014-10-11 06:42:18 +00:00
reinoud ef40ac265a Fix bug introduced in last patch 2014-09-17 21:18:43 +00:00
reinoud 79652a00ee As pointed out by wiz@ prevent a possible attack or corruption that results in
an endless loop of indirect descriptors being processed.

The number of indirect descriptors followed is now maximized.
While here, also fix a use-after-free bug!
2014-09-17 19:47:05 +00:00
reinoud e3b6b3457e Posix requires the va_size of a symlink to be pathlength for symbolic links.
This fixes yet another atf case.
2014-07-29 15:48:22 +00:00
reinoud 60e6f474d5 Fix debug printout of udf_write_metadata_partition_spacetable(), it referred
to an old variable.
2014-07-29 15:36:43 +00:00
reinoud a72b8dae23 Access time should only be set on accessing the data or messing with the
contents, not on inode access rights and ownership changes. Should address
PR kern/49033 for UDF.

Test results now come clean for bugs related to this issue in the ATF.
2014-07-29 11:10:12 +00:00
dholland 05d075b3ae Add VOP_FALLOCATE and VOP_FDISCARD to every vnode ops table I can
find.

The filesystem ones all call genfs_eopnotsupp - right now I am only
implementing the plumbing and we can implement fallocate and/or
fdiscard for files later.

The device ones call spec_fallocate (which is also genfs_eopnotsupp)
and spec_fdiscard, which dispatches to the device-level op.

The fifo ones all call vn_fifo_bypass, which also ends up being
EOPNOTSUPP.
2014-07-25 08:20:51 +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
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
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
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 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
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