Date: Mon, 3 Jan 2011 20:37:31 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r216931 - in head/sys: conf fs/nfsclient fs/nfsserver nfs nfsclient nlm Message-ID: <201101032037.p03KbVYm004591@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Mon Jan 3 20:37:31 2011 New Revision: 216931 URL: http://svn.freebsd.org/changeset/base/216931 Log: Fix the nlm so that it no longer depends on the regular nfs client and, as such, can be loaded for the experimental nfs client without the regular client. Reviewed by: jhb MFC after: 2 weeks Modified: head/sys/conf/files head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/fs/nfsclient/nfsmount.h head/sys/fs/nfsserver/nfs_nfsdport.c head/sys/nfs/nfs_lock.c head/sys/nfs/nfs_mountcommon.h head/sys/nfsclient/nfs_vfsops.c head/sys/nfsclient/nfsmount.h head/sys/nlm/nlm_advlock.c head/sys/nlm/nlm_prot_impl.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Jan 3 20:32:08 2011 (r216930) +++ head/sys/conf/files Mon Jan 3 20:37:31 2011 (r216931) @@ -2719,7 +2719,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 +nfs/nfs_lock.c optional nfsclient | nfscl | nfslockd | nfsd nfsclient/bootp_subr.c optional bootp nfsclient nfsclient/krpc_subr.c optional bootp nfsclient nfsclient/nfs_bio.c optional nfsclient @@ -2735,7 +2735,7 @@ nfsserver/nfs_serv.c optional nfsserver nfsserver/nfs_srvkrpc.c optional nfsserver nfsserver/nfs_srvsubs.c optional nfsserver nfs/nfs_nfssvc.c optional nfsserver | nfscl | nfsd -nlm/nlm_advlock.c optional nfslockd nfsclient | nfsd nfsclient +nlm/nlm_advlock.c optional nfslockd | nfsd nlm/nlm_prot_clnt.c optional nfslockd | nfsd nlm/nlm_prot_impl.c optional nfslockd | nfsd nlm/nlm_prot_server.c optional nfslockd | nfsd Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Mon Jan 3 20:32:08 2011 (r216930) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Mon Jan 3 20:37:31 2011 (r216931) @@ -102,7 +102,8 @@ static int mountnfs(struct nfs_args *, s struct sockaddr *, char *, u_char *, u_char *, u_char *, struct vnode **, struct ucred *, struct thread *, int); static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, - struct sockaddr_storage *, int *, off_t *); + struct sockaddr_storage *, int *, off_t *, + struct timeval *); static vfs_mount_t nfs_mount; static vfs_cmount_t nfs_cmount; static vfs_unmount_t nfs_unmount; @@ -1123,6 +1124,7 @@ mountnfs(struct nfs_args *argp, struct m mtx_init(&nmp->nm_sockreq.nr_mtx, "nfssock", NULL, MTX_DEF); mp->mnt_data = nmp; nmp->nm_getinfo = nfs_getnlminfo; + nmp->nm_vinvalbuf = ncl_vinvalbuf; } vfs_getnewfsid(mp); nmp->nm_mountp = mp; @@ -1465,7 +1467,8 @@ nfs_sysctl(struct mount *mp, fsctlop_t o */ static void nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, size_t *fhlenp, - struct sockaddr_storage *sp, int *is_v3p, off_t *sizep) + struct sockaddr_storage *sp, int *is_v3p, off_t *sizep, + struct timeval *timeop) { struct nfsmount *nmp; struct nfsnode *np = VTONFS(vp); @@ -1481,5 +1484,9 @@ nfs_getnlminfo(struct vnode *vp, uint8_t *is_v3p = NFS_ISV3(vp); if (sizep != NULL) *sizep = np->n_size; + if (timeop != NULL) { + timeop->tv_sec = nmp->nm_timeo / NFS_HZ; + timeop->tv_usec = (nmp->nm_timeo % NFS_HZ) * (1000000 / NFS_HZ); + } } Modified: head/sys/fs/nfsclient/nfsmount.h ============================================================================== --- head/sys/fs/nfsclient/nfsmount.h Mon Jan 3 20:32:08 2011 (r216930) +++ head/sys/fs/nfsclient/nfsmount.h Mon Jan 3 20:37:31 2011 (r216931) @@ -94,6 +94,7 @@ struct nfsmount { #define nm_retry nm_com.nmcom_retry #define nm_hostname nm_com.nmcom_hostname #define nm_getinfo nm_com.nmcom_getinfo +#define nm_vinvalbuf nm_com.nmcom_vinvalbuf #define NFSMNT_DIRPATH(m) (&((m)->nm_name[(m)->nm_krbnamelen + 1])) #define NFSMNT_SRVKRBNAME(m) \ Modified: head/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdport.c Mon Jan 3 20:32:08 2011 (r216930) +++ head/sys/fs/nfsserver/nfs_nfsdport.c Mon Jan 3 20:37:31 2011 (r216931) @@ -3142,6 +3142,7 @@ DECLARE_MODULE(nfsd, nfsd_mod, SI_SUB_VF /* So that loader and kldload(2) can find us, wherever we are.. */ MODULE_VERSION(nfsd, 1); MODULE_DEPEND(nfsd, nfscommon, 1, 1, 1); +MODULE_DEPEND(nfsd, nfslock, 1, 1, 1); MODULE_DEPEND(nfsd, nfslockd, 1, 1, 1); MODULE_DEPEND(nfsd, krpc, 1, 1, 1); MODULE_DEPEND(nfsd, nfssvc, 1, 1, 1); Modified: head/sys/nfs/nfs_lock.c ============================================================================== --- head/sys/nfs/nfs_lock.c Mon Jan 3 20:32:08 2011 (r216930) +++ head/sys/nfs/nfs_lock.c Mon Jan 3 20:37:31 2011 (r216931) @@ -251,7 +251,7 @@ nfs_dolock(struct vop_advlock_args *ap) ASSERT_VOP_LOCKED(vp, "nfs_dolock"); nmp->nm_getinfo(vp, msg.lm_fh, &msg.lm_fh_len, &msg.lm_addr, - &msg.lm_nfsv3, NULL); + &msg.lm_nfsv3, NULL, NULL); VOP_UNLOCK(vp, 0); /* Modified: head/sys/nfs/nfs_mountcommon.h ============================================================================== --- head/sys/nfs/nfs_mountcommon.h Mon Jan 3 20:32:08 2011 (r216930) +++ head/sys/nfs/nfs_mountcommon.h Mon Jan 3 20:37:31 2011 (r216931) @@ -35,7 +35,9 @@ * a mechanism for getting the client specific info for an nfs vnode. */ typedef void nfs_getinfofromvp_ftype(struct vnode *, uint8_t *, size_t *, - struct sockaddr_storage *, int *, off_t *); + struct sockaddr_storage *, int *, off_t *, + struct timeval *); +typedef int nfs_vinvalbuf_ftype(struct vnode *, int, struct thread *, int); struct nfsmount_common { struct mtx nmcom_mtx; @@ -46,6 +48,7 @@ struct nfsmount_common { int nmcom_retry; /* Max retries */ char nmcom_hostname[MNAMELEN]; /* server's name */ nfs_getinfofromvp_ftype *nmcom_getinfo; /* Get info from nfsnode */ + nfs_vinvalbuf_ftype *nmcom_vinvalbuf; /* Invalidate buffers */ }; #endif /* _NFS_MOUNTCOMMON_H_ */ Modified: head/sys/nfsclient/nfs_vfsops.c ============================================================================== --- head/sys/nfsclient/nfs_vfsops.c Mon Jan 3 20:32:08 2011 (r216930) +++ head/sys/nfsclient/nfs_vfsops.c Mon Jan 3 20:37:31 2011 (r216931) @@ -116,7 +116,8 @@ static int mountnfs(struct nfs_args *, s struct sockaddr *, char *, struct vnode **, struct ucred *cred, int); static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, - struct sockaddr_storage *, int *, off_t *); + struct sockaddr_storage *, int *, off_t *, + struct timeval *); static vfs_mount_t nfs_mount; static vfs_cmount_t nfs_cmount; static vfs_unmount_t nfs_unmount; @@ -1205,6 +1206,7 @@ mountnfs(struct nfs_args *argp, struct m TAILQ_INIT(&nmp->nm_bufq); mp->mnt_data = nmp; nmp->nm_getinfo = nfs_getnlminfo; + nmp->nm_vinvalbuf = nfs_vinvalbuf; } vfs_getnewfsid(mp); nmp->nm_mountp = mp; @@ -1499,7 +1501,8 @@ nfs_sysctl(struct mount *mp, fsctlop_t o */ static void nfs_getnlminfo(struct vnode *vp, uint8_t *fhp, size_t *fhlenp, - struct sockaddr_storage *sp, int *is_v3p, off_t *sizep) + struct sockaddr_storage *sp, int *is_v3p, off_t *sizep, + struct timeval *timeop) { struct nfsmount *nmp; struct nfsnode *np = VTONFS(vp); @@ -1515,5 +1518,9 @@ nfs_getnlminfo(struct vnode *vp, uint8_t *is_v3p = NFS_ISV3(vp); if (sizep != NULL) *sizep = np->n_size; + if (timeop != NULL) { + timeop->tv_sec = nmp->nm_timeo / NFS_HZ; + timeop->tv_usec = (nmp->nm_timeo % NFS_HZ) * (1000000 / NFS_HZ); + } } Modified: head/sys/nfsclient/nfsmount.h ============================================================================== --- head/sys/nfsclient/nfsmount.h Mon Jan 3 20:32:08 2011 (r216930) +++ head/sys/nfsclient/nfsmount.h Mon Jan 3 20:37:31 2011 (r216931) @@ -100,6 +100,7 @@ struct nfsmount { #define nm_retry nm_com.nmcom_retry #define nm_hostname nm_com.nmcom_hostname #define nm_getinfo nm_com.nmcom_getinfo +#define nm_vinvalbuf nm_com.nmcom_vinvalbuf #if defined(_KERNEL) /* Modified: head/sys/nlm/nlm_advlock.c ============================================================================== --- head/sys/nlm/nlm_advlock.c Mon Jan 3 20:32:08 2011 (r216930) +++ head/sys/nlm/nlm_advlock.c Mon Jan 3 20:37:31 2011 (r216931) @@ -217,20 +217,18 @@ nlm_advlock_internal(struct vnode *vp, v ASSERT_VOP_LOCKED(vp, "nlm_advlock_1"); + nmp = VFSTONFS(vp->v_mount); /* * Push any pending writes to the server and flush our cache * so that if we are contending with another machine for a * file, we get whatever they wrote and vice-versa. */ if (op == F_SETLK || op == F_UNLCK) - nfs_vinvalbuf(vp, V_SAVE, td, 1); + nmp->nm_vinvalbuf(vp, V_SAVE, td, 1); - nmp = VFSTONFS(vp->v_mount); strcpy(servername, nmp->nm_hostname); - nmp->nm_getinfo(vp, fh.fh_bytes, &fhlen, &ss, &is_v3, &size); + nmp->nm_getinfo(vp, fh.fh_bytes, &fhlen, &ss, &is_v3, &size, &timo); sa = (struct sockaddr *) &ss; - timo.tv_sec = nmp->nm_timeo / NFS_HZ; - timo.tv_usec = (nmp->nm_timeo % NFS_HZ) * (1000000 / NFS_HZ); if (is_v3 != 0) vers = NLM_VERS4; else Modified: head/sys/nlm/nlm_prot_impl.c ============================================================================== --- head/sys/nlm/nlm_prot_impl.c Mon Jan 3 20:32:08 2011 (r216930) +++ head/sys/nlm/nlm_prot_impl.c Mon Jan 3 20:37:31 2011 (r216931) @@ -2430,6 +2430,5 @@ DECLARE_MODULE(nfslockd, nfslockd_mod, S /* So that loader and kldload(2) can find us, wherever we are.. */ MODULE_DEPEND(nfslockd, krpc, 1, 1, 1); -MODULE_DEPEND(nfslockd, nfs, 1, 1, 1); MODULE_DEPEND(nfslockd, nfslock, 1, 1, 1); MODULE_VERSION(nfslockd, 1);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101032037.p03KbVYm004591>