Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jan 2011 01:26:13 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r217495 - in stable/8/sys: conf fs/nfsclient fs/nfsserver nfs nfsclient nlm
Message-ID:  <201101170126.p0H1QDZa083717@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Mon Jan 17 01:26:13 2011
New Revision: 217495
URL: http://svn.freebsd.org/changeset/base/217495

Log:
  MFC: r216931
  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.

Modified:
  stable/8/sys/conf/files
  stable/8/sys/fs/nfsclient/nfs_clvfsops.c
  stable/8/sys/fs/nfsclient/nfsmount.h
  stable/8/sys/fs/nfsserver/nfs_nfsdport.c
  stable/8/sys/nfs/nfs_lock.c
  stable/8/sys/nfs/nfs_mountcommon.h
  stable/8/sys/nfsclient/nfs_vfsops.c
  stable/8/sys/nfsclient/nfsmount.h
  stable/8/sys/nlm/nlm_advlock.c
  stable/8/sys/nlm/nlm_prot_impl.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/conf/files
==============================================================================
--- stable/8/sys/conf/files	Mon Jan 17 01:11:06 2011	(r217494)
+++ stable/8/sys/conf/files	Mon Jan 17 01:26:13 2011	(r217495)
@@ -2659,7 +2659,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
@@ -2675,7 +2675,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: stable/8/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clvfsops.c	Mon Jan 17 01:11:06 2011	(r217494)
+++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c	Mon Jan 17 01:26:13 2011	(r217495)
@@ -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: stable/8/sys/fs/nfsclient/nfsmount.h
==============================================================================
--- stable/8/sys/fs/nfsclient/nfsmount.h	Mon Jan 17 01:11:06 2011	(r217494)
+++ stable/8/sys/fs/nfsclient/nfsmount.h	Mon Jan 17 01:26:13 2011	(r217495)
@@ -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: stable/8/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdport.c	Mon Jan 17 01:11:06 2011	(r217494)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c	Mon Jan 17 01:26:13 2011	(r217495)
@@ -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: stable/8/sys/nfs/nfs_lock.c
==============================================================================
--- stable/8/sys/nfs/nfs_lock.c	Mon Jan 17 01:11:06 2011	(r217494)
+++ stable/8/sys/nfs/nfs_lock.c	Mon Jan 17 01:26:13 2011	(r217495)
@@ -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: stable/8/sys/nfs/nfs_mountcommon.h
==============================================================================
--- stable/8/sys/nfs/nfs_mountcommon.h	Mon Jan 17 01:11:06 2011	(r217494)
+++ stable/8/sys/nfs/nfs_mountcommon.h	Mon Jan 17 01:26:13 2011	(r217495)
@@ -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: stable/8/sys/nfsclient/nfs_vfsops.c
==============================================================================
--- stable/8/sys/nfsclient/nfs_vfsops.c	Mon Jan 17 01:11:06 2011	(r217494)
+++ stable/8/sys/nfsclient/nfs_vfsops.c	Mon Jan 17 01:26:13 2011	(r217495)
@@ -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: stable/8/sys/nfsclient/nfsmount.h
==============================================================================
--- stable/8/sys/nfsclient/nfsmount.h	Mon Jan 17 01:11:06 2011	(r217494)
+++ stable/8/sys/nfsclient/nfsmount.h	Mon Jan 17 01:26:13 2011	(r217495)
@@ -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: stable/8/sys/nlm/nlm_advlock.c
==============================================================================
--- stable/8/sys/nlm/nlm_advlock.c	Mon Jan 17 01:11:06 2011	(r217494)
+++ stable/8/sys/nlm/nlm_advlock.c	Mon Jan 17 01:26:13 2011	(r217495)
@@ -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: stable/8/sys/nlm/nlm_prot_impl.c
==============================================================================
--- stable/8/sys/nlm/nlm_prot_impl.c	Mon Jan 17 01:11:06 2011	(r217494)
+++ stable/8/sys/nlm/nlm_prot_impl.c	Mon Jan 17 01:26:13 2011	(r217495)
@@ -2309,6 +2309,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?201101170126.p0H1QDZa083717>