Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/nfs Instead of storing the filehandle in the mount struc...
details: https://anonhg.NetBSD.org/src/rev/3e2df74d221e
branches: trunk
changeset: 503740:3e2df74d221e
user: fvdl <fvdl%NetBSD.org@localhost>
date: Mon Feb 12 20:02:30 2001 +0000
description:
Instead of storing the filehandle in the mount structure, store the
vnode pointer. This avoids a locking problem with nfs_nget, and
can be done because we always have a reference on the root vnode
of the filesystem.
diffstat:
sys/nfs/nfs_vfsops.c | 33 +++++++++++++--------------------
sys/nfs/nfsmount.h | 5 ++---
2 files changed, 15 insertions(+), 23 deletions(-)
diffs (123 lines):
diff -r 92eb29ccb8fb -r 3e2df74d221e sys/nfs/nfs_vfsops.c
--- a/sys/nfs/nfs_vfsops.c Mon Feb 12 19:49:20 2001 +0000
+++ b/sys/nfs/nfs_vfsops.c Mon Feb 12 20:02:30 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfs_vfsops.c,v 1.100 2001/02/06 11:40:02 fvdl Exp $ */
+/* $NetBSD: nfs_vfsops.c,v 1.101 2001/02/12 20:02:30 fvdl Exp $ */
/*
* Copyright (c) 1989, 1993, 1995
@@ -148,16 +148,12 @@
#endif
struct mbuf *mreq, *mrep = NULL, *md, *mb, *mb2;
struct ucred *cred;
- struct nfsnode *np;
u_quad_t tquad;
#ifndef nolint
sfp = (struct nfs_statfs *)0;
#endif
- error = nfs_nget(mp, (nfsfh_t *)nmp->nm_fh, nmp->nm_fhsize, &np);
- if (error)
- return (error);
- vp = NFSTOV(np);
+ vp = nmp->nm_vnode;
cred = crget();
cred->cr_ngroups = 0;
if (v3 && (nmp->nm_iflag & NFSMNT_GOTFSINFO) == 0)
@@ -207,7 +203,6 @@
}
strncpy(&sbp->f_fstypename[0], mp->mnt_op->vfs_name, MFSNAMELEN);
nfsm_reqdone;
- vput(vp);
crfree(cred);
return (error);
}
@@ -682,8 +677,6 @@
nmp->nm_deadthresh = NQ_DEADTHRESH;
CIRCLEQ_INIT(&nmp->nm_timerhead);
nmp->nm_inprog = NULLVP;
- nmp->nm_fhsize = argp->fhsize;
- memcpy((caddr_t)nmp->nm_fh, (caddr_t)argp->fh, argp->fhsize);
#ifdef COMPAT_09
mp->mnt_stat.f_type = 2;
#else
@@ -718,7 +711,7 @@
* point.
*/
mp->mnt_stat.f_iosize = NFS_MAXDGRAMDATA;
- error = nfs_nget(mp, (nfsfh_t *)nmp->nm_fh, nmp->nm_fhsize, &np);
+ error = nfs_nget(mp, (nfsfh_t *)argp->fh, argp->fhsize, &np);
if (error)
goto bad;
*vpp = NFSTOV(np);
@@ -741,6 +734,7 @@
* number == ROOTINO (2). So, just unlock, but no rele.
*/
+ nmp->nm_vnode = *vpp;
VOP_UNLOCK(*vpp, 0);
return (0);
@@ -761,7 +755,6 @@
struct proc *p;
{
struct nfsmount *nmp;
- struct nfsnode *np;
struct vnode *vp;
int error, flags = 0;
@@ -782,10 +775,11 @@
* the remote root. See comment in mountnfs(). The VFS unmount()
* has done vput on this vnode, otherwise we would get deadlock!
*/
- error = nfs_nget(mp, (nfsfh_t *)nmp->nm_fh, nmp->nm_fhsize, &np);
- if (error)
- return(error);
- vp = NFSTOV(np);
+ vp = nmp->nm_vnode;
+ error = vget(vp, LK_EXCLUSIVE | LK_RETRY);
+ if (error != 0)
+ return error;
+
if ((mntflags & MNT_FORCE) == 0 && vp->v_usecount > 2) {
vput(vp);
return (EBUSY);
@@ -839,14 +833,13 @@
{
struct vnode *vp;
struct nfsmount *nmp;
- struct nfsnode *np;
int error;
nmp = VFSTONFS(mp);
- error = nfs_nget(mp, (nfsfh_t *)nmp->nm_fh, nmp->nm_fhsize, &np);
- if (error)
- return (error);
- vp = NFSTOV(np);
+ vp = nmp->nm_vnode;
+ error = vget(vp, LK_EXCLUSIVE | LK_RETRY);
+ if (error != 0)
+ return error;
if (vp->v_type == VNON)
vp->v_type = VDIR;
vp->v_flag = VROOT;
diff -r 92eb29ccb8fb -r 3e2df74d221e sys/nfs/nfsmount.h
--- a/sys/nfs/nfsmount.h Mon Feb 12 19:49:20 2001 +0000
+++ b/sys/nfs/nfsmount.h Mon Feb 12 20:02:30 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nfsmount.h,v 1.19 2000/03/16 18:08:31 jdolecek Exp $ */
+/* $NetBSD: nfsmount.h,v 1.20 2001/02/12 20:02:30 fvdl Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -119,8 +119,7 @@
int nm_flag; /* Flags for soft/hard... */
struct mount *nm_mountp; /* Vfs structure for this filesystem */
int nm_numgrps; /* Max. size of groupslist */
- u_char nm_fh[NFSX_V3FHMAX]; /* File handle of root dir */
- int nm_fhsize; /* Size of root file handle */
+ struct vnode *nm_vnode;
struct socket *nm_so; /* Rpc socket */
int nm_sotype; /* Type of socket */
int nm_soproto; /* and protocol */
Home |
Main Index |
Thread Index |
Old Index