diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2010-07-24 22:11:11 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2010-07-24 22:11:11 +0000 |
commit | c7c4e3ebae85ae531fe298149a6ce0b2a0643a04 (patch) | |
tree | 4eec6454349918ebb035552eba42b0ef1fd7eaa6 | |
parent | 0dd9a760b4e6c729904b4821a46073d2840a105c (diff) | |
download | FreeBSD-src-c7c4e3ebae85ae531fe298149a6ce0b2a0643a04.zip FreeBSD-src-c7c4e3ebae85ae531fe298149a6ce0b2a0643a04.tar.gz |
Move sys/nfsclient/nfs_lock.c into sys/nfs and build it as a separate
module that can be used by both the regular and experimental nfs
clients. This fixes the problem reported by jh@ where /dev/nfslock
would be registered twice when both nfs clients were used.
I also defined the size of the lm_fh field to be the correct value,
as it should be the maximum size of an NFSv3 file handle.
Reviewed by: jh
MFC after: 2 weeks
-rw-r--r-- | sys/conf/files | 3 | ||||
-rw-r--r-- | sys/fs/nfsclient/nfs_cllock.c | 396 | ||||
-rw-r--r-- | sys/fs/nfsclient/nfs_clnfsiod.c | 1 | ||||
-rw-r--r-- | sys/fs/nfsclient/nfs_clport.c | 1 | ||||
-rw-r--r-- | sys/fs/nfsclient/nfs_clsubs.c | 1 | ||||
-rw-r--r-- | sys/fs/nfsclient/nfs_clvnops.c | 6 | ||||
-rw-r--r-- | sys/fs/nfsclient/nfs_lock.h | 89 | ||||
-rw-r--r-- | sys/modules/Makefile | 1 | ||||
-rw-r--r-- | sys/modules/nfscl/Makefile | 1 | ||||
-rw-r--r-- | sys/modules/nfsclient/Makefile | 2 | ||||
-rw-r--r-- | sys/modules/nfslock/Makefile | 9 | ||||
-rw-r--r-- | sys/nfs/nfs_lock.c (renamed from sys/nfsclient/nfs_lock.c) | 2 | ||||
-rw-r--r-- | sys/nfs/nfs_lock.h (renamed from sys/nfsclient/nfs_lock.h) | 4 | ||||
-rw-r--r-- | sys/nfsclient/nfs_nfsiod.c | 2 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vfsops.c | 1 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 2 |
16 files changed, 21 insertions, 500 deletions
diff --git a/sys/conf/files b/sys/conf/files index 0f0acf0..e85e31c 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1914,7 +1914,6 @@ fs/nfsclient/nfs_clrpcops.c optional nfscl fs/nfsclient/nfs_clvnops.c optional nfscl fs/nfsclient/nfs_clnode.c optional nfscl fs/nfsclient/nfs_clvfsops.c optional nfscl -fs/nfsclient/nfs_cllock.c optional nfscl fs/nfsclient/nfs_clport.c optional nfscl fs/nfsclient/nfs_clbio.c optional nfscl fs/nfsclient/nfs_clnfsiod.c optional nfscl @@ -2680,6 +2679,7 @@ netsmb/smb_subr.c optional netsmb netsmb/smb_trantcp.c optional netsmb netsmb/smb_usr.c optional netsmb nfs/nfs_common.c optional nfsclient | nfsserver +nfs/nfs_lock.c optional nfsclient | nfscl nfsclient/bootp_subr.c optional bootp nfsclient nfsclient/krpc_subr.c optional bootp nfsclient nfsclient/nfs_bio.c optional nfsclient @@ -2690,7 +2690,6 @@ nfsclient/nfs_subs.c optional nfsclient nfsclient/nfs_nfsiod.c optional nfsclient nfsclient/nfs_vfsops.c optional nfsclient nfsclient/nfs_vnops.c optional nfsclient -nfsclient/nfs_lock.c optional nfsclient nfsserver/nfs_fha.c optional nfsserver nfsserver/nfs_serv.c optional nfsserver nfsserver/nfs_srvkrpc.c optional nfsserver diff --git a/sys/fs/nfsclient/nfs_cllock.c b/sys/fs/nfsclient/nfs_cllock.c deleted file mode 100644 index a0b4e7c..0000000 --- a/sys/fs/nfsclient/nfs_cllock.c +++ /dev/null @@ -1,396 +0,0 @@ -/*- - * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Berkeley Software Design Inc's name may not be used to endorse or - * promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from BSDI nfs_lock.c,v 2.4 1998/12/14 23:49:56 jch Exp - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/fcntl.h> -#include <sys/kernel.h> /* for hz */ -#include <sys/limits.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/lockf.h> /* for hz */ /* Must come after sys/malloc.h */ -#include <sys/mbuf.h> -#include <sys/mount.h> -#include <sys/namei.h> -#include <sys/priv.h> -#include <sys/proc.h> -#include <sys/resourcevar.h> -#include <sys/socket.h> -#include <sys/socket.h> -#include <sys/unistd.h> -#include <sys/vnode.h> - -#include <net/if.h> - -#include <fs/nfs/nfsport.h> -#include <fs/nfsclient/nfsmount.h> -#include <fs/nfsclient/nfs.h> -#include <fs/nfsclient/nfsnode.h> -#include <fs/nfsclient/nfs_lock.h> -#include <fs/nfsclient/nlminfo.h> - -extern void (*nlminfo_release_p)(struct proc *p); - -MALLOC_DEFINE(M_NEWNFSLOCK, "newnfsclient_lock", "NEWNFS lock request"); -MALLOC_DEFINE(M_NEWNLMINFO, "newnfsclient_nlminfo", "NEWNFS lock process structure"); - -static int nfslockdans(struct thread *td, struct lockd_ans *ansp); -static void nlminfo_release(struct proc *p); -/* - * -------------------------------------------------------------------- - * A miniature device driver which the userland uses to talk to us. - * - */ - -static struct cdev *nfslock_dev; -static struct mtx nfslock_mtx; -static int nfslock_isopen; -static TAILQ_HEAD(,__lock_msg) nfslock_list; - -static int -nfslock_open(struct cdev *dev, int oflags, int devtype, struct thread *td) -{ - int error; - - error = priv_check(td, PRIV_NFS_LOCKD); - if (error) - return (error); - - mtx_lock(&nfslock_mtx); - if (!nfslock_isopen) { - error = 0; - nfslock_isopen = 1; - } else { - error = EOPNOTSUPP; - } - mtx_unlock(&nfslock_mtx); - - return (error); -} - -static int -nfslock_close(struct cdev *dev, int fflag, int devtype, struct thread *td) -{ - struct __lock_msg *lm; - - mtx_lock(&nfslock_mtx); - nfslock_isopen = 0; - while (!TAILQ_EMPTY(&nfslock_list)) { - lm = TAILQ_FIRST(&nfslock_list); - /* XXX: answer request */ - TAILQ_REMOVE(&nfslock_list, lm, lm_link); - free(lm, M_NEWNFSLOCK); - } - mtx_unlock(&nfslock_mtx); - return (0); -} - -static int -nfslock_read(struct cdev *dev, struct uio *uio, int ioflag) -{ - int error; - struct __lock_msg *lm; - - if (uio->uio_resid != sizeof *lm) - return (EOPNOTSUPP); - lm = NULL; - error = 0; - mtx_lock(&nfslock_mtx); - while (TAILQ_EMPTY(&nfslock_list)) { - error = msleep(&nfslock_list, &nfslock_mtx, PSOCK | PCATCH, - "nfslockd", 0); - if (error) - break; - } - if (!error) { - lm = TAILQ_FIRST(&nfslock_list); - TAILQ_REMOVE(&nfslock_list, lm, lm_link); - } - mtx_unlock(&nfslock_mtx); - if (!error) { - error = uiomove(lm, sizeof *lm, uio); - free(lm, M_NEWNFSLOCK); - } - return (error); -} - -static int -nfslock_write(struct cdev *dev, struct uio *uio, int ioflag) -{ - struct lockd_ans la; - int error; - - if (uio->uio_resid != sizeof la) - return (EOPNOTSUPP); - error = uiomove(&la, sizeof la, uio); - if (!error) - error = nfslockdans(curthread, &la); - return (error); -} - -static int -nfslock_send(struct __lock_msg *lm) -{ - struct __lock_msg *lm2; - int error; - - error = 0; - lm2 = malloc(sizeof *lm2, M_NEWNFSLOCK, M_WAITOK); - mtx_lock(&nfslock_mtx); - if (nfslock_isopen) { - memcpy(lm2, lm, sizeof *lm2); - TAILQ_INSERT_TAIL(&nfslock_list, lm2, lm_link); - wakeup(&nfslock_list); - } else { - error = EOPNOTSUPP; - } - mtx_unlock(&nfslock_mtx); - if (error) - free(lm2, M_NEWNFSLOCK); - return (error); -} - -static struct cdevsw nfslock_cdevsw = { - .d_version = D_VERSION, - .d_open = nfslock_open, - .d_close = nfslock_close, - .d_read = nfslock_read, - .d_write = nfslock_write, - .d_name = "nfslock" -}; - -static int -newnfslock_modevent(module_t mod __unused, int type, void *data __unused) -{ - - switch (type) { - case MOD_LOAD: - if (bootverbose) - printf("nfslock: pseudo-device\n"); - mtx_init(&nfslock_mtx, "nfslock", NULL, MTX_DEF); - TAILQ_INIT(&nfslock_list); - nlminfo_release_p = nlminfo_release; - nfslock_dev = make_dev(&nfslock_cdevsw, 0, - UID_ROOT, GID_KMEM, 0600, _PATH_NFSLCKDEV); - return (0); - default: - return (EOPNOTSUPP); - } -} - -DEV_MODULE(newnfslock, newnfslock_modevent, NULL); -MODULE_VERSION(newnfslock, 1); - - -/* - * XXX - * We have to let the process know if the call succeeded. I'm using an extra - * field in the p_nlminfo field in the proc structure, as it is already for - * lockd stuff. - */ - -/* - * nfs_advlock -- - * NFS advisory byte-level locks. - * - * The vnode shall be (shared) locked on the entry, it is - * unconditionally unlocked after. - */ -int -ncl_dolock(struct vop_advlock_args *ap) -{ - LOCKD_MSG msg; - struct thread *td; - struct vnode *vp; - int error; - struct flock *fl; - struct proc *p; - - td = curthread; - p = td->td_proc; - - vp = ap->a_vp; - fl = ap->a_fl; - - ASSERT_VOP_LOCKED(vp, "nfs_dolock"); - - bcopy(VFSTONFS(vp->v_mount)->nm_nam, &msg.lm_addr, - min(sizeof msg.lm_addr, VFSTONFS(vp->v_mount)->nm_nam->sa_len)); - msg.lm_fh_len = NFS_ISV3(vp) ? VTONFS(vp)->n_fhsize : NFSX_V2FH; - bcopy(VTONFS(vp)->n_fhp->nfh_fh, msg.lm_fh, msg.lm_fh_len); - msg.lm_nfsv3 = NFS_ISV3(vp); - VOP_UNLOCK(vp, 0); - - /* - * the NLM protocol doesn't allow the server to return an error - * on ranges, so we do it. - */ - if (fl->l_whence != SEEK_END) { - if ((fl->l_whence != SEEK_CUR && fl->l_whence != SEEK_SET) || - fl->l_start < 0 || - (fl->l_len < 0 && - (fl->l_start == 0 || fl->l_start + fl->l_len < 0))) - return (EINVAL); - if (fl->l_len > 0 && - (fl->l_len - 1 > OFF_MAX - fl->l_start)) - return (EOVERFLOW); - } - - /* - * Fill in the information structure. - */ - msg.lm_version = LOCKD_MSG_VERSION; - msg.lm_msg_ident.pid = p->p_pid; - - mtx_lock(&Giant); - /* - * if there is no nfsowner table yet, allocate one. - */ - if (p->p_nlminfo == NULL) { - p->p_nlminfo = malloc(sizeof(struct nlminfo), - M_NEWNLMINFO, M_WAITOK | M_ZERO); - p->p_nlminfo->pid_start = p->p_stats->p_start; - timevaladd(&p->p_nlminfo->pid_start, &boottime); - } - msg.lm_msg_ident.pid_start = p->p_nlminfo->pid_start; - msg.lm_msg_ident.msg_seq = ++(p->p_nlminfo->msg_seq); - - msg.lm_fl = *fl; - msg.lm_wait = ap->a_flags & F_WAIT; - msg.lm_getlk = ap->a_op == F_GETLK; - cru2x(td->td_ucred, &msg.lm_cred); - - for (;;) { - error = nfslock_send(&msg); - if (error) - goto out; - - /* Unlocks succeed immediately. */ - if (fl->l_type == F_UNLCK) - goto out; - - /* - * Retry after 20 seconds if we haven't gotten a response yet. - * This number was picked out of thin air... but is longer - * then even a reasonably loaded system should take (at least - * on a local network). XXX Probably should use a back-off - * scheme. - * - * XXX: No PCATCH here since we currently have no useful - * way to signal to the userland rpc.lockd that the request - * has been aborted. Once the rpc.lockd implementation - * can handle aborts, and we report them properly, - * PCATCH can be put back. In the mean time, if we did - * permit aborting, the lock attempt would "get lost" - * and the lock would get stuck in the locked state. - */ - error = tsleep(p->p_nlminfo, PUSER, "lockd", 20*hz); - if (error != 0) { - if (error == EWOULDBLOCK) { - /* - * We timed out, so we rewrite the request - * to the fifo. - */ - continue; - } - - break; - } - - if (msg.lm_getlk && p->p_nlminfo->retcode == 0) { - if (p->p_nlminfo->set_getlk_pid) { - fl->l_sysid = 0; /* XXX */ - fl->l_pid = p->p_nlminfo->getlk_pid; - } else { - fl->l_type = F_UNLCK; - } - } - error = p->p_nlminfo->retcode; - break; - } - out: - mtx_unlock(&Giant); - return (error); -} - -/* - * nfslockdans -- - * NFS advisory byte-level locks answer from the lock daemon. - */ -static int -nfslockdans(struct thread *td, struct lockd_ans *ansp) -{ - struct proc *targetp; - - /* the version should match, or we're out of sync */ - if (ansp->la_vers != LOCKD_ANS_VERSION) - return (EINVAL); - - /* Find the process, set its return errno and wake it up. */ - if ((targetp = pfind(ansp->la_msg_ident.pid)) == NULL) - return (ESRCH); - - /* verify the pid hasn't been reused (if we can), and it isn't waiting - * for an answer from a more recent request. We return an EPIPE if - * the match fails, because we've already used ESRCH above, and this - * is sort of like writing on a pipe after the reader has closed it. - */ - if (targetp->p_nlminfo == NULL || - ((ansp->la_msg_ident.msg_seq != -1) && - (timevalcmp(&targetp->p_nlminfo->pid_start, - &ansp->la_msg_ident.pid_start, !=) || - targetp->p_nlminfo->msg_seq != ansp->la_msg_ident.msg_seq))) { - PROC_UNLOCK(targetp); - return (EPIPE); - } - - targetp->p_nlminfo->retcode = ansp->la_errno; - targetp->p_nlminfo->set_getlk_pid = ansp->la_set_getlk_pid; - targetp->p_nlminfo->getlk_pid = ansp->la_getlk_pid; - - wakeup(targetp->p_nlminfo); - - PROC_UNLOCK(targetp); - return (0); -} - -/* - * Free nlminfo attached to process. - */ -static void -nlminfo_release(struct proc *p) -{ - free(p->p_nlminfo, M_NEWNLMINFO); - p->p_nlminfo = NULL; -} diff --git a/sys/fs/nfsclient/nfs_clnfsiod.c b/sys/fs/nfsclient/nfs_clnfsiod.c index 62ea4f8..4c33497 100644 --- a/sys/fs/nfsclient/nfs_clnfsiod.c +++ b/sys/fs/nfsclient/nfs_clnfsiod.c @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include <fs/nfsclient/nfsmount.h> #include <fs/nfsclient/nfs.h> #include <fs/nfsclient/nfsnode.h> -#include <fs/nfsclient/nfs_lock.h> extern struct mtx ncl_iod_mutex; diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index 99e73d8..4d610b4 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -1268,4 +1268,5 @@ MODULE_VERSION(nfscl, 1); MODULE_DEPEND(nfscl, nfscommon, 1, 1, 1); MODULE_DEPEND(nfscl, krpc, 1, 1, 1); MODULE_DEPEND(nfscl, nfssvc, 1, 1, 1); +MODULE_DEPEND(nfscl, nfslock, 1, 1, 1); diff --git a/sys/fs/nfsclient/nfs_clsubs.c b/sys/fs/nfsclient/nfs_clsubs.c index 07f0123..61554f0 100644 --- a/sys/fs/nfsclient/nfs_clsubs.c +++ b/sys/fs/nfsclient/nfs_clsubs.c @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include <fs/nfsclient/nfsnode.h> #include <fs/nfsclient/nfsmount.h> #include <fs/nfsclient/nfs.h> -#include <fs/nfsclient/nfs_lock.h> #include <netinet/in.h> diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index bc623ed..97c7bd8 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -67,24 +67,24 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_extern.h> #include <vm/vm_object.h> - #include <fs/nfs/nfsport.h> #include <fs/nfsclient/nfsnode.h> #include <fs/nfsclient/nfsmount.h> #include <fs/nfsclient/nfs.h> -#include <fs/nfsclient/nfs_lock.h> #include <net/if.h> #include <netinet/in.h> #include <netinet/in_var.h> +#include <nfs/nfs_lock.h> + /* Defs */ #define TRUE 1 #define FALSE 0 extern struct nfsstats newnfsstats; MALLOC_DECLARE(M_NEWNFSREQ); -vop_advlock_t *ncl_advlock_p = ncl_dolock; +vop_advlock_t *ncl_advlock_p = nfs_dolock; /* * Ifdef for FreeBSD-current merged buffer cache. It is unfortunate that these diff --git a/sys/fs/nfsclient/nfs_lock.h b/sys/fs/nfsclient/nfs_lock.h deleted file mode 100644 index 58fc949..0000000 --- a/sys/fs/nfsclient/nfs_lock.h +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Berkeley Software Design Inc's name may not be used to endorse or - * promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * lockd uses the nfssvc system call to get the unique kernel services it needs. - * It passes in a request structure with a version number at the start. - * This prevents libc from needing to change if the information passed - * between lockd and the kernel needs to change. - * - * If a structure changes, you must bump the version number. - */ - -/* - * The fifo where the kernel writes requests for locks on remote NFS files, - * and where lockd reads these requests. - * - */ -#define _PATH_NFSLCKDEV "nfslock" - -/* - * This structure is used to uniquely identify the process which originated - * a particular message to lockd. A sequence number is used to differentiate - * multiple messages from the same process. A process start time is used to - * detect the unlikely, but possible, event of the recycling of a pid. - */ -struct lockd_msg_ident { - pid_t pid; /* The process ID. */ - struct timeval pid_start; /* Start time of process id */ - int msg_seq; /* Sequence number of message */ -}; - -#define LOCKD_MSG_VERSION 3 - -/* - * The structure that the kernel hands us for each lock request. - */ -typedef struct __lock_msg { - TAILQ_ENTRY(__lock_msg) lm_link; /* internal linkage */ - int lm_version; /* which version is this */ - struct lockd_msg_ident lm_msg_ident; /* originator of the message */ - struct flock lm_fl; /* The lock request. */ - int lm_wait; /* The F_WAIT flag. */ - int lm_getlk; /* is this a F_GETLK request */ - struct sockaddr_storage lm_addr; /* The address. */ - int lm_nfsv3; /* If NFS version 3. */ - size_t lm_fh_len; /* The file handle length. */ - struct xucred lm_cred; /* user cred for lock req */ - u_int8_t lm_fh[NFSX_V3FHMAX];/* The file handle. */ -} LOCKD_MSG; - -#define LOCKD_ANS_VERSION 1 - -struct lockd_ans { - int la_vers; - struct lockd_msg_ident la_msg_ident; /* originator of the message */ - int la_errno; - int la_set_getlk_pid; /* use returned pid */ - int la_getlk_pid; /* returned pid for F_GETLK */ -}; - -#ifdef _KERNEL -int ncl_dolock(struct vop_advlock_args *ap); -#endif diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 191d629..d033a34 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -205,6 +205,7 @@ SUBDIR= ${_3dfx} \ nfsclient \ nfscommon \ nfsd \ + nfslock \ nfslockd \ nfsserver \ nfssvc \ diff --git a/sys/modules/nfscl/Makefile b/sys/modules/nfscl/Makefile index 66d5d93..7b95932 100644 --- a/sys/modules/nfscl/Makefile +++ b/sys/modules/nfscl/Makefile @@ -9,7 +9,6 @@ SRCS= vnode_if.h \ nfs_clcomsubs.c \ nfs_clport.c \ nfs_clbio.c \ - nfs_cllock.c \ nfs_clnfsiod.c \ nfs_clnode.c \ nfs_clsubs.c \ diff --git a/sys/modules/nfsclient/Makefile b/sys/modules/nfsclient/Makefile index 5cd3556..0ce3d41 100644 --- a/sys/modules/nfsclient/Makefile +++ b/sys/modules/nfsclient/Makefile @@ -4,7 +4,7 @@ KMOD= nfsclient SRCS= vnode_if.h \ - nfs_bio.c nfs_lock.c nfs_node.c nfs_subs.c nfs_nfsiod.c \ + nfs_bio.c nfs_node.c nfs_subs.c nfs_nfsiod.c \ nfs_vfsops.c nfs_vnops.c nfs_krpc.c \ opt_inet.h opt_nfs.h opt_bootp.h opt_nfsroot.h SRCS+= opt_inet6.h opt_kdtrace.h opt_kgssapi.h diff --git a/sys/modules/nfslock/Makefile b/sys/modules/nfslock/Makefile new file mode 100644 index 0000000..0a1e208 --- /dev/null +++ b/sys/modules/nfslock/Makefile @@ -0,0 +1,9 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../nfs +KMOD= nfslock +SRCS= vnode_if.h \ + nfs_lock.c \ + opt_nfs.h + +.include <bsd.kmod.mk> diff --git a/sys/nfsclient/nfs_lock.c b/sys/nfs/nfs_lock.c index 6bd126a..89ad654 100644 --- a/sys/nfsclient/nfs_lock.c +++ b/sys/nfs/nfs_lock.c @@ -54,10 +54,10 @@ __FBSDID("$FreeBSD$"); #include <net/if.h> #include <nfs/nfsproto.h> +#include <nfs/nfs_lock.h> #include <nfsclient/nfs.h> #include <nfsclient/nfsmount.h> #include <nfsclient/nfsnode.h> -#include <nfsclient/nfs_lock.h> #include <nfsclient/nlminfo.h> extern void (*nlminfo_release_p)(struct proc *p); diff --git a/sys/nfsclient/nfs_lock.h b/sys/nfs/nfs_lock.h index b49d12c..aa99996 100644 --- a/sys/nfsclient/nfs_lock.h +++ b/sys/nfs/nfs_lock.h @@ -37,8 +37,6 @@ * If a structure changes, you must bump the version number. */ -#include <nfs/nfsproto.h> - /* * The fifo where the kernel writes requests for locks on remote NFS files, * and where lockd reads these requests. @@ -74,7 +72,7 @@ typedef struct __lock_msg { int lm_nfsv3; /* If NFS version 3. */ size_t lm_fh_len; /* The file handle length. */ struct xucred lm_cred; /* user cred for lock req */ - u_int8_t lm_fh[NFS_SMALLFH];/* The file handle. */ + u_int8_t lm_fh[NFSX_V3FHMAX];/* The file handle. */ } LOCKD_MSG; #define LOCKD_ANS_VERSION 1 diff --git a/sys/nfsclient/nfs_nfsiod.c b/sys/nfsclient/nfs_nfsiod.c index 5302c56..d192848 100644 --- a/sys/nfsclient/nfs_nfsiod.c +++ b/sys/nfsclient/nfs_nfsiod.c @@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$"); #include <nfsclient/nfsm_subs.h> #include <nfsclient/nfsmount.h> #include <nfsclient/nfsnode.h> -#include <nfsclient/nfs_lock.h> +#include <nfs/nfs_lock.h> static MALLOC_DEFINE(M_NFSSVC, "nfsclient_srvsock", "Nfs server structure"); diff --git a/sys/nfsclient/nfs_vfsops.c b/sys/nfsclient/nfs_vfsops.c index a4ef316..f07bf16 100644 --- a/sys/nfsclient/nfs_vfsops.c +++ b/sys/nfsclient/nfs_vfsops.c @@ -148,6 +148,7 @@ MODULE_DEPEND(nfs, krpc, 1, 1, 1); MODULE_DEPEND(nfs, kgssapi, 1, 1, 1); #endif MODULE_DEPEND(nfs, nfs_common, 1, 1, 1); +MODULE_DEPEND(nfs, nfslock, 1, 1, 1); static struct nfs_rpcops nfs_rpcops = { nfs_readrpc, diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index f3323f9..015a1de 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); #include <nfsclient/nfsnode.h> #include <nfsclient/nfsmount.h> #include <nfsclient/nfs_kdtrace.h> -#include <nfsclient/nfs_lock.h> +#include <nfs/nfs_lock.h> #include <nfs/xdr_subs.h> #include <nfsclient/nfsm_subs.h> |