Commit Graph

201 Commits

Author SHA1 Message Date
dholland c6c16cd073 - Add a new vnode op: VOP_PARSEPATH.
- Move namei_getcomponent to genfs_vnops.c and call it genfs_parsepath.
 - Add a parsepath entry to every vnode ops table.

VOP_PARSEPATH takes a directory vnode to be searched and a complete
following path and chooses how much of that path to consume. To begin
with, all parsepath calls are genfs_parsepath, which locates the first
'/' as always.

Note that the call doesn't take the whole struct componentname, only
the string. The other bits of struct componentname should not be
needed and there's no reason to cause potential complications by
exposing them.
2021-06-29 22:34:05 +00:00
hannken 618809e522 ntfs_loadntnode(): Use bread() when ntm_sysvn[NTFS_MFTINO] is NULL.
May happen when loading node 0 (MFT) during mount and some
attributes are stored in another ntnode.

PR kern/56160 (Mount ntfs usb disk)
2021-05-13 08:57:29 +00:00
christos 79e3c74f8e Introduce genfs_pathconf() and use it for the default case in all filesystems. 2020-06-27 17:29:17 +00:00
christos 9aa2a9c323 Add ACL support for FFS. From FreeBSD. 2020-05-16 18:31:45 +00:00
ad 23bf88000c Replace most uses of vp->v_usecount with a call to vrefcnt(vp), a function
that hides the details and does atomic_load_relaxed().  Signature matches
FreeBSD.
2020-04-13 19:23:17 +00:00
ad c2e9cb9413 VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, to
allow us to get shared locks (or no lock) on the returned vnode.  Matches
FreeBSD.
2020-01-17 20:08:06 +00:00
hannken 62dd7866ca When the MFT record size is lower than the cluster size we have
to read consecutive clusters to fill the MFT record.

Should fix PR kern/54598: mount ntfs panic
2019-10-18 08:19:33 +00:00
hannken 5bde8f1cdb It is not possible to call vflush() from xxx_mount().
Replace with a vnode iterator and use vrecycle().
2019-10-18 08:18:40 +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
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 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
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
maxv 14c9669847 Cosmetic changes:
- add a ffs-like ntfs_superblock_validate function
 - remove unused includes
 - fix some comments
 - KNF

No functional change.
2015-02-20 17:08:13 +00:00
maxv ec1a3951d6 Fix a node leak.
Sent on tech-kern@, tested by martin@
2015-01-16 17:02:12 +00:00
hannken 9e220db89c No need to load a vnode/fnode pair to lookup attributes on a ntnode.
Use ntfs_ntlookup()/ntfs_ntput() instead.
2015-01-06 11:04:00 +00:00
hannken e8b589e23d Adjust printf and add missing ntfs_ntput(). 2015-01-06 11:03:09 +00:00
christos ea82045eab add more debugging. 2015-01-04 16:19:12 +00:00
maxv 0f13b9e40d Typos:
- "nessesary" -> "necessary" (comment)
 - "UNEXISTED" -> "NON-EXISTENT" (dprintf)
 - "NON-EXISTANT" -> "NON-EXISTENT" (dprintf)
 - "reach" -> "reaches" (comment)
2014-12-29 16:37:27 +00:00
maxv 6387e6748f Make this more readable (KNF). 2014-12-28 14:42:56 +00:00
maxv fc8f062e48 Prevent another division by zero in ntfs_loadntnode() by ensuring
spc != 0.
2014-12-28 13:11:52 +00:00
maxv c1acce042f Ensure bps != 0 to prevent a division by zero. Zero byte per sector makes
no sense.
2014-12-28 12:57:44 +00:00
maxv 6d178278b3 Two typos:
- reserver4 -> reserved4 (in struct bootfile)
 - "inducates" -> "indicates" (comment)
2014-12-28 12:19:21 +00:00
maxv ead51937de Make this more readable (KNF). 2014-12-28 12:13:22 +00:00
hannken 0bac62655e Change ntfs to vcache.
- Use (inumber, attrtype, attrname) as key.
- Inline ntfs_fget() and ntfs_frele() as they only get called once.
2014-11-13 16:51:53 +00:00
hannken a26eea283a - Change ntfs_vgetex() to always load the ntnode and fnode.
- Take the vnode attributes from the NAME attribute.
- Remove now unused ntfs_times() and ntfs_filesize().
- Treat nodes without an unnamed DATA attribute as zero-sized regular files.
2014-11-13 16:51:10 +00:00
hannken 6f8e2ffe40 - Fix ntfs_ntlookupattr() to make the examples from the man page work.
- Fix ntfs_loadntnode() to always read full cluster to prevent buffer
  cache inconsistency.
- Change ntfs_vgetex() and ntfs_fget() to take a const attrname and
  always pass a possibly empty string.
- Change printf to dprintf.
- Get rid of dead fields i_next, i_prev of struct ntnode.
2014-11-13 16:49:56 +00:00
uebayasi fe9a32c84e Define filesystem attributes with vfs dependency. 2014-10-11 06:42:18 +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
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
christos 9c43792b5f CID 975205: Unchecked return value 2013-12-10 18:20:32 +00:00
christos 0b725b63c7 change the mountlist CIRCLEQ into a TAILQ 2013-11-23 13:35:36 +00:00
christos ba0dd1c1e6 remove unused code 2013-10-17 21:03:50 +00:00
hannken 3881f4f3f9 Replace macro v_specmountpoint with two functions spec_node_getmountedfs()
and spec_node_setmountedfs() to manage the file system mounted on a device.
Assert the device is a block device.

Welcome to 6.99.24

Discussed on tech-kern@ some time ago.

Reviewed by: David Holland <dholland@netbsd.org>
2013-09-30 18:57:59 +00:00
matt d2b8f70ecf Make this compile again. 2013-06-28 17:13:34 +00:00
christos c22fbb82f6 remove useless initialization, KNF
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
2013-06-28 15:46:37 +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
hannken 312d89f0de Change bread() and breadn() to never return a buffer on
error and modify all callers to not brelse() on error.

Welcome to 6.99.16

PR kern/46282 (6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread)
2012-12-20 08:03:41 +00:00
dholland 35ed690545 Excise struct componentname from the namecache.
This uglifies the interface, because several operations need to be
passed the namei flags and cache_lookup also needs for the time being
to be passed cnp->cn_nameiop. Nonetheless, it's a net benefit.

The glop should be able to go away eventually but requires structural
cleanup elsewhere first.

This change requires a kernel bump.
2012-11-05 17:27:37 +00:00
dholland 1617a81dd1 Disentangle the namecache from the internals of namei.
- Move the namecache's hash computation to inside the namecache code,
instead of being spread out all over the place. Remove cn_hash from
struct componentname and delete all uses of it.

 - It is no longer necessary (if it ever was) for cache_lookup and
cache_lookup_raw to clear MAKEENTRY from cnp->cn_flags for the cases
that cache_enter already checks for.

 - Rearrange the interface of cache_lookup (and cache_lookup_raw) to
make it somewhat simpler, to exclude certain nonexistent error
conditions, and (most importantly) to make it not require write access
to cnp->cn_flags.

This change requires a kernel bump.
2012-11-05 17:24:09 +00:00
rmind d65753d972 Move some the test for MAKEENTRY into the cache_enter(9). Make some
variables in vfs_cache.c static, __read_mostly, etc.

No objection on tech-kern@.
2012-07-22 00:53:18 +00:00
dsl 609d5cf3c1 Fix build - eg i386/ALL 2012-07-12 17:24:47 +00:00
christos fd4605203e - fix some mallocs not to have casts and specify sizeof(*var)
- if the index magic is 0, don't complain, just return an error.
- make dprintfs use __func__
2012-06-02 16:26:24 +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