Commit Graph

1288 Commits

Author SHA1 Message Date
manu 45ab7f236a Fix soft NFS force unmount
For many reasons, forcibly unmounting a soft NFS mount could hang forever.
Here are the fixes:
- Introduce decents timeouts in operation that awaited NFS server reply.
- On timeout, fails operations on soft mounts with EIO.
- Introduce NFSMNT_DISMNTFORCE to let the filesystem know that a
  force unmount is ongoing. This causes timeouts to be reduced and
  prevents the NFS client to attempt reconnecting to the NFS server.

Also fix a race condition where some asynchronous I/O could reference
destroyed mount structures. We fix this by awaiting asynchronous I/O
to drain before proceeding.

Reviewed by Chuck Silvers.
2015-07-15 03:28:55 +00:00
mrg 8dc77cd94a add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
2015-06-22 10:35:00 +00:00
rtr d458601fe5 change nfs_boot_sendrecv to take sockaddr_in * instead of mbuf *
fixes m_serv (single mbuf leak) leak in kern/subr_tftproot.c
2015-05-21 02:04:22 +00:00
chs 6dafee9c7b in nfs_writerpc(), avoid a signed/unsigned problem in computing the
number of bytes to back up in the uio when we need to resend a write RPC
(eg. after a server crash) on a 64-bit platform.  should fix PR 35448.
2015-05-14 17:35:54 +00:00
rtr 8b82ed454c when calling nfs_boot_sendrecv pass NULL for pointers instead of 0 2015-05-09 18:12:19 +00:00
rtr d53103fc75 change sosend() to accept sockaddr * instead of mbuf * for nam.
bump to 7.99.16
2015-05-09 15:22:47 +00:00
rtr fd12cf39ee make connect syscall use sockaddr_big and modify pr_{send,connect}
nam parameter type from buf * to sockaddr *.

final commit for parameter type changes to protocol user requests

* bump kernel version to 7.99.15 for parameter type changes to pr_{send,connect}
2015-05-02 17:18:03 +00:00
riastradh e6d0ae95b0 Cull unused INRENAME and INRELOOKUP from callers. 2015-04-21 03:19:03 +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 3373340e21 Nix LEASE_READ/LEASE_WRITE from <sys/vnode.h>. 2015-04-20 13:12:24 +00:00
rtr a2ba5e69ab * change pr_bind to accept struct sockaddr * instead of struct mbuf *
* update protocol bind implementations to use/expect sockaddr *
  instead of mbuf *
* introduce sockaddr_big struct for storage of addr data passed via
  sys_bind; sockaddr_big is of sufficient size and alignment to
  accommodate all addr data sizes received.
* modify sys_bind to allocate sockaddr_big instead of using an mbuf.
* bump kernel version to 7.99.9 for change to pr_bind() parameter type.

Patch posted to tech-net@
  http://mail-index.netbsd.org/tech-net/2015/03/15/msg005004.html

The choice to use a new structure sockaddr_big has been retained since
changing sockaddr_storage size would lead to unnecessary ABI change. The
use of the new structure does not preclude future work that increases
the size of sockaddr_storage and at that time sockaddr_big may be
trivially replaced.

Tested by mrg@ and myself, discussed with rmind@, posted to tech-net@
2015-04-03 20:01:07 +00:00
hikaru 638842f16d m_pullup() is called in rcvproc callback functions,
so nfs_boot_sendrecv() should keep track of the head of mbuf chain.
fixes kern/48746
2015-03-27 07:18:11 +00:00
maxv 8bf6e1b17b Fix uninitialized variable.
Found by The Brainy Code Scanner in FreeBSD.
2015-03-06 19:03:30 +00:00
uebayasi fe9a32c84e Define filesystem attributes with vfs dependency. 2014-10-11 06:42:18 +00:00
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