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
This commit is contained in:
parent
75e493953d
commit
53f27d6094
@ -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
|
||||
|
@ -102,7 +102,8 @@ static int mountnfs(struct nfs_args *, struct mount *,
|
||||
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 mount *mp, struct sockaddr *nam,
|
||||
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 op, struct sysctl_req *req)
|
||||
*/
|
||||
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 *fhp, size_t *fhlenp,
|
||||
*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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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) \
|
||||
|
@ -3142,6 +3142,7 @@ DECLARE_MODULE(nfsd, nfsd_mod, SI_SUB_VFS, SI_ORDER_ANY);
|
||||
/* 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);
|
||||
|
@ -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);
|
||||
|
||||
/*
|
||||
|
@ -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_ */
|
||||
|
@ -116,7 +116,8 @@ static int mountnfs(struct nfs_args *, struct mount *,
|
||||
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 mount *mp, struct sockaddr *nam,
|
||||
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 op, struct sysctl_req *req)
|
||||
*/
|
||||
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 *fhp, size_t *fhlenp,
|
||||
*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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
/*
|
||||
|
@ -217,20 +217,18 @@ nlm_advlock_internal(struct vnode *vp, void *id, int op, struct flock *fl,
|
||||
|
||||
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
|
||||
|
@ -2430,6 +2430,5 @@ DECLARE_MODULE(nfslockd, nfslockd_mod, SI_SUB_VFS, SI_ORDER_ANY);
|
||||
|
||||
/* 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);
|
||||
|
Loading…
Reference in New Issue
Block a user