Commit Graph

52 Commits

Author SHA1 Message Date
chs fd34ea77eb remove checks for failure after memory allocation calls that cannot fail:
kmem_alloc() with KM_SLEEP
  kmem_zalloc() with KM_SLEEP
  percpu_alloc()
  pserialize_create()
  psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
2017-06-01 02:45:05 +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
hannken 20bb034f5b Remove unused argument "nextp" from vfs_busy() and vfs_unbusy().
Remove argument "keepref" from vfs_unbusy() and add vfs_ref() where needed.
2017-04-17 08:32:00 +00:00
hannken ebb8f73b4b Add vfs_ref(mp) and vfs_rele(mp) to add or remove a reference to
struct mount.  Rename vfs_destroy(mp) to vfs_rele(mp) and replace
incrementing mp->mnt_refcnt with vfs_ref(mp).
2017-04-17 08:31:01 +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
hannken 9888a178c6 Update mtime when updating file size.
PR kern/51762 (mtime not updated by open(O_TRUNC))
2017-04-08 08:49:44 +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
hannken 7139aab724 Remove now obsolete operation vcache_remove().
Welcome to 7.99.36
2016-08-20 12:37:06 +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
maxv 6e39240181 Remove the 'cred' argument from bread(). Remove a now unused var in
ffs_snapshot.c. Update the man page accordingly.

ok hannken@
2015-03-28 19:24:04 +00:00
hannken 9837a8c2e9 Change v7fs to vcache. 2014-12-29 15:29:38 +00:00
hannken b1a3c148f6 Defer deallocating unlinked inodes to v7fs_reclaim().
Remove v7fs_vnode_reload() and always use v7fs_inode_load().  No need
to search for a vnode we already hold a reference on.
2014-12-29 15:28:58 +00:00
hannken 2d6e8595d5 v7fs_getattr: adjust size of symlinks by -1 to compensate the trailing NUL.
Should fix the v7fs part of PR kern/48864.
2014-12-29 15:28:08 +00:00
uebayasi fe9a32c84e Define filesystem attributes with vfs dependency. 2014-10-11 06:42:18 +00:00
gson f3b28c737c Whitespace fix 2014-08-08 19:14:45 +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
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
christos 0b725b63c7 change the mountlist CIRCLEQ into a TAILQ 2013-11-23 13:35:36 +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
christos b9bf0e6c5d prevent memory leak on error
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
2013-06-28 14:49:14 +00:00
plunky 5ec364d4d9 C99 section 6.7.2.3 (Tags) Note 3 states that:
A type specifier of the form

	enum identifier

  without an enumerator list shall only appear after the type it
  specifies is complete.

which means that we cannot pass an "enum vtype" argument to
kauth_access_action() without fully specifying the type first.
Unfortunately there is a complicated include file loop which
makes that difficult, so convert this minimal function into a
macro (and capitalize it).

(ok elad@)
2013-03-18 19:35:35 +00:00
msaitoh b6e1d8e8d8 Fix off by one error. 2012-12-07 06:50:15 +00:00
joerg 15a60c04b8 Ensure that error is initialized in all code paths. 2012-06-13 22:56:50 +00:00
chs 8306a9eddf change vflushbuf() to take the full FSYNC_* flags.
translate FSYNC_LAZY into PGO_LAZY for VOP_PUTPAGES() so that
genfs_do_io() can set the appropriate io priority for the I/O.
this is the first part of addressing PR 46325.
2012-04-29 22:53:59 +00:00
njoly ea834bf0c0 Make v7fs_getattr() report file flags, and adjust v7fs_setattr() to
allow unsetting SF_APPEND flag.
2012-03-31 21:44:28 +00:00
njoly 8725631c5c Pass operations flags to genfs_can_chtimes(), not file ones. 2012-03-22 22:16:21 +00:00
christos fa04ef14fe don't re-define MIN 2012-03-21 15:55:50 +00:00
elad 0c9d8d15c9 Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

    http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
    http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
    http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
2012-03-13 18:40:26 +00:00
njoly f5adce712b Check parent directory write permission for DELETE operation.
ok uch@.
2012-01-27 12:22:02 +00:00
christos 1058c21f81 use getdisksize() 2011-11-13 23:08:47 +00:00
apb 464d645aeb Rename all static functions to have "v7fs_" prefix. Fixes a problem
in the tools build, where the static link() and unlink() functions
conflicted with those declared in <unistd.h>.
2011-08-14 09:02:07 +00:00
uch f2404aeb3c Remove suspicious warning message. 2011-08-08 11:42:30 +00:00
dholland 66d63879a2 Insert casts to off_t to avoid 32-bit multiplication overflow when
computing device offsets on 32-bit platforms. Should fix PR 45191.
2011-08-03 16:21:52 +00:00
uch b53b51d13e v7fs_lookup() fix return value. Pass t_vnops rename_dir(3)
v7fs_setttr() check credential. Pass t_unpriv owner
v7fs_rename() reload inode(v7fs_vnode_reload). Pass t_vnops rename_reg_nodir
2011-07-30 03:53:18 +00:00
uch 53172ceae2 When rename directory, check hierarchy. Pass t_vnops rename_dir(5) 2011-07-30 03:52:04 +00:00
uch cba32d8fa9 Fix return vaule. Pass t_vnops:rename_dotdot, dir_noempty, rename_dir(6) 2011-07-30 03:51:53 +00:00
uch fbcb953c8f Existing inode don't recycle. rump works. 2011-07-24 12:31:33 +00:00
uch 803c773c57 remove partition check from v7fs_mount. problem on rump implementation. 2011-07-23 05:10:30 +00:00
apb f1ca1ce2bf In sources that get compiled into the tools version of makefs, add:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif

This should fix cross-build problems, but I can't really test
that now, so I am not re-enabling the inclusion of v7fs support
in makefs.
2011-07-18 21:51:49 +00:00
uch 6a2dbe9ae4 core symlink operation moved to v7fs_file_util.c and introduce V7FSBSD_MAXSYMLINKLEN for makefs 2011-07-16 12:35:40 +00:00
uch f96feeccb7 export v7fs_datablock_addr for makefs 2011-07-16 12:35:32 +00:00
uch fa2ab7e4a5 Fix readdir eofflag(bogus eofflags was setted). getcwd works. 2011-07-13 12:28:57 +00:00
uch 7572a219c6 Fix inode update method. chown and chmod works. 2011-07-13 12:22:49 +00:00
uch 709aeb1f3a When filesize is zero, correctly return V7FS_ITERATOR_END 2011-07-13 12:18:22 +00:00