Commit Graph

1274 Commits

Author SHA1 Message Date
matt 45b1ec740d Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
2014-09-05 09:20:59 +00:00
matt cf2d76c1f9 Don't use catch as a variable name. 2014-09-05 05:34:57 +00:00
matt 96c79f1a27 Don't nest structure definitions. 2014-09-05 05:34:41 +00:00
tls ea6af427bd Merge tls-earlyentropy branch into HEAD. 2014-08-10 16:44:32 +00:00
rtr 651e5bd3f8 split PRU_SEND function out of pr_generic() usrreq switches and put into
separate functions

   xxx_send(struct socket *, struct mbuf *, struct mbuf *,
       struct mbuf *, struct lwp *)

  - always KASSERT(solocked(so)) even if not implemented

  - replace calls to pr_generic() with req = PRU_SEND with calls to
    pr_send()

rename existing functions that operate on PCB for consistency (and to
free up their names for xxx_send() PRUs

  - l2cap_send() -> l2cap_send_pcb()
  - sco_send() -> sco_send_pcb()
  - rfcomm_send() -> rfcomm_send_pcb()

patch reviewed by rmind
2014-08-05 07:55:31 +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
hannken 0d77f6a387 Use vcache_rekey_* for nfs_lookitup() in the "*npp != NULL" case. 2014-07-05 09:33:41 +00:00
hannken ff361c30ec Change NFS from rbtree to vcache. 2014-05-30 08:47:45 +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
rmind 39bd8dee77 Add struct pr_usrreqs with a pr_generic function and prepare for the
dismantling of pr_usrreq in the protocols; no functional change intended.
PRU_ATTACH/PRU_DETACH changes will follow soon.

Bump for struct protosw.  Welcome to 6.99.62!
2014-05-18 14:46:15 +00:00
christos 3d0d60dd15 PR/48426: Dimitris Karagkasidis: Convert to sized, unsigned types.
Ideally we could use uint64_t, but for compatibility and performance
we don't (for now)
2014-04-24 18:43:02 +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 835102c3e9 Change nfs_clearcommit() to use vfs_vnode_iterator. 2014-03-17 09:35:24 +00:00
hannken f4c84c255f Change nfs_sync() to use vfs_vnode_iterator. 2014-03-17 09:34:51 +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
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 cfda4afeac only prevent autounload, not regular unload when we have exports 2013-12-14 22:04:03 +00:00
christos d956cedc98 don't allow the nfs server module to unload if it has exported filesystems. 2013-12-14 16:19:28 +00:00
christos d7eb6ac205 CID 271162: NULL deref check 2013-11-27 22:10:47 +00:00
christos 8f0dbf3022 convert from CIRCLEQ to TAILQ 2013-11-23 14:20:46 +00:00
christos 0b725b63c7 change the mountlist CIRCLEQ into a TAILQ 2013-11-23 13:35:36 +00:00
nisimura c33cfaf7a6 add one more __unused attribute to shut gcc4.8 off. 2013-11-15 14:39:53 +00:00
martin 10e9e653af Mark a potentially unused variable 2013-10-25 20:46:29 +00:00
martin b083a17f72 Mark a diagnostic-only variable 2013-10-25 16:01:56 +00:00
pgoyette 0d34da2a3d knf (blank line even if there are no local declarations) 2013-09-18 23:27:38 +00:00
christos 0105cbeff0 Use reference counting to keep track of construction and destruction of the
structures used by both the nfs server and client code. Tested by pgoyette@

1. mount remote fs via nfs (my /home directory), which autoloads nfs module
2. manually modload nfsserver
3. wait a bit
4. manually modunload nfsserver
5. wait a couple minutes
6. verify that client access still works (/bin/ls ~paul home dir)
7. manually modload nfsserver again
8. start an nfsd process
9. wait a bit
10. kill nfsd process
11. wait
12. manually modunload nfsserver again
13. verify continued client access

XXX: Note that nfs_vfs_init() calls nfs_init(), but nfs_vfs_done() does not
     call nfs_fini(). Also note that the destruction order is wrong in it,
     but probably does not matter. "someone" (!= me) should fix it :-) and
     run the above tests.
2013-09-18 16:33:14 +00:00
martin fd52abfdd4 Remove __CT_LOCAL_.. hack 2013-09-15 13:03:59 +00:00
martin 6fd75b6342 Backout wildcard pragma to kill warnings and instead sprinkle a few dozen
__unused attributes.
Requested by joerg@
2013-09-14 22:29:08 +00:00
martin bf8ace275c Remove unused variable 2013-09-14 22:27:01 +00:00
martin 6de1257930 Silence gcc 4.8.1 warnings 2013-09-14 21:48:49 +00:00
martin cbb31ed1c7 Avoid unused variable warnings 2013-09-14 21:17:00 +00:00
martin 7313b1fe48 Guard a function local CTASSERT with pro/epilogue 2013-09-14 21:11:45 +00:00
drochner 45702ddfef tyop in comment, from Eivind Evensen via OpenBSD 2013-09-12 18:00:18 +00:00
dholland 0a50969465 Use __CTASSERT instead of handrolled version. 2013-08-30 07:35:44 +00:00
dholland 13106e31df more typos in comments 2013-08-30 07:30:50 +00:00
dholland 99c51e18cd typo in comment 2013-08-30 07:25:43 +00:00
hannken d12406b413 Function nfs_vinvalbuf() ignores errors from vinvalbuf() and therefore
delayed write errors may get lost.
Change nfs_vinvalbuf() to keep errors from vinvalbuf() for fsync() or close().

Presented on tech-kern@

Fix for PR kern/47980 (NFS over-quota not detected if utimes() called
before fsync()/close())
2013-08-12 17:46:38 +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
joerg e240adbd0b Retire OSI network stack. OK core@ 2013-03-01 18:25:13 +00:00
dholland dcd34a91c5 Stuff UFS_ in front of a few of ufs's symbols to reduce namespace
pollution. Specifically:
   ROOTINO -> UFS_ROOTINO
   WINO -> UFS_WINO
   NXADDR -> UFS_NXADDR
   NDADDR -> UFS_NDADDR
   NIADDR -> UFS_NIADDR
   MAXSYMLINKLEN -> UFS_MAXSYMLINKLEN
   MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency)

Sort out ext2fs's misuse of NDADDR and NIADDR; fortunately, these have
the same values in ext2fs and ffs.

No functional change intended.
2013-01-22 09:39:11 +00:00
macallan 635775b851 fix crash in nfs client lookups, dholland says 'my fault' 2012-11-07 02:31:48 +00:00
dholland b496a9dc26 Rename the new ni_startdir (the slot used to hold the starting point
for openat() and friends) to ni_atdir to avoid confusion with a
previously existing (and, alas, still documented) ni_startdir field
that meant something else entirely.
2012-11-05 19:06:26 +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
dholland ebc30f9e8b Replace hack implementation of NDAT() for "nameiat" with a proper one.
(This change requires a kernel bump.)
2012-10-13 17:46:50 +00:00
christos b0fb40a0ab When unloading the nfsserver module, call nfs_fini() so that the nfsrvdescpl
pool gets destroyed. Otherwise we are left with a stray pool that points to
unmapped memory behind (and bad things happen). Typically you get seemingly
random page faults (without printing uvm_fault) that happen in various pool
operations. Most frequent one is the pool_drain() from the page daemon.
2012-08-29 14:00:22 +00:00