summaryrefslogtreecommitdiffstats
path: root/sys/nfs/nfs_nqlease.c
diff options
context:
space:
mode:
authordyson <dyson@FreeBSD.org>1997-02-10 02:22:35 +0000
committerdyson <dyson@FreeBSD.org>1997-02-10 02:22:35 +0000
commit10f666af84d48e89e4e2960415c9b616fce4077f (patch)
tree88a944de263165091f0a18abeedbaaccec532407 /sys/nfs/nfs_nqlease.c
parent0960d7e91af3428ffba89b42228d82d8afaa0389 (diff)
downloadFreeBSD-src-10f666af84d48e89e4e2960415c9b616fce4077f.zip
FreeBSD-src-10f666af84d48e89e4e2960415c9b616fce4077f.tar.gz
This is the kernel Lite/2 commit. There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
Diffstat (limited to 'sys/nfs/nfs_nqlease.c')
-rw-r--r--sys/nfs/nfs_nqlease.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/sys/nfs/nfs_nqlease.c b/sys/nfs/nfs_nqlease.c
index 2fa8360..1740b82 100644
--- a/sys/nfs/nfs_nqlease.c
+++ b/sys/nfs/nfs_nqlease.c
@@ -33,10 +33,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)nfs_nqlease.c 8.3 (Berkeley) 1/4/94
+ * @(#)nfs_nqlease.c 8.9 (Berkeley) 5/20/95
* $FreeBSD$
*/
+
/*
* References:
* Cary G. Gray and David R. Cheriton, "Leases: An Efficient Fault-Tolerant
@@ -84,11 +85,8 @@ struct vop_lease_args;
static int nqsrv_cmpnam __P((struct nfssvc_sock *,struct mbuf *,
struct nqhost *));
-extern void nqnfs_lease_check __P((struct vnode *vp, struct proc *p,
- struct ucred *cred, int flag));
extern void nqnfs_lease_updatetime __P((int deltat));
static int nqnfs_vacated __P((struct vnode *vp, struct ucred *cred));
-extern int nqnfs_vop_lease_check __P((struct vop_lease_args *ap));
static void nqsrv_addhost __P((struct nqhost *lph, struct nfssvc_sock *slp,
struct mbuf *nam));
static void nqsrv_instimeq __P((struct nqlease *lp, u_long duration));
@@ -136,6 +134,7 @@ extern nfstype nfsv3_type[9];
extern struct nfssvc_sock *nfs_udpsock, *nfs_cltpsock;
extern int nfsd_waiting;
extern struct nfsstats nfsstats;
+extern int nfs_mount_type;
#define TRUE 1
#define FALSE 0
@@ -349,7 +348,6 @@ nqnfs_lease_check(vp, p, cred, flag)
#endif /* NFS_NOSERVER */
-#ifdef HAS_VOPLEASE
int
nqnfs_vop_lease_check(ap)
struct vop_lease_args /* {
@@ -367,7 +365,6 @@ nqnfs_vop_lease_check(ap)
NQLOCALSLP, ap->a_p, (struct mbuf *)0, &cache, &frev, ap->a_cred);
return (0);
}
-#endif
/*
* Add a host to an nqhost structure for a lease.
@@ -1090,7 +1087,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
vp = NFSTOV(np);
vpid = vp->v_id;
if (np->n_expiry < time.tv_sec) {
- if (vget(vp, 1) == 0) {
+ if (vget(vp, LK_EXCLUSIVE, p) == 0) {
nmp->nm_inprog = vp;
if (vpid == vp->v_id) {
CIRCLEQ_REMOVE(&nmp->nm_timerhead, np, n_timer);
@@ -1115,7 +1112,7 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
} else if ((np->n_expiry - NQ_RENEWAL) < time.tv_sec) {
if ((np->n_flag & (NQNFSWRITE | NQNFSNONCACHE))
== NQNFSWRITE && vp->v_dirtyblkhd.lh_first &&
- vget(vp, 1) == 0) {
+ vget(vp, LK_EXCLUSIVE, p) == 0) {
nmp->nm_inprog = vp;
if (vpid == vp->v_id &&
nqnfs_getlease(vp, ND_WRITE, cred, p)==0)
@@ -1179,9 +1176,10 @@ void
nqnfs_lease_updatetime(deltat)
register int deltat;
{
- register struct nqlease *lp;
- register struct nfsnode *np;
- struct mount *mp;
+ struct proc *p = curproc; /* XXX */
+ struct nqlease *lp;
+ struct nfsnode *np;
+ struct mount *mp, *nxtmp;
struct nfsmount *nmp;
int s;
@@ -1197,13 +1195,13 @@ nqnfs_lease_updatetime(deltat)
* Search the mount list for all nqnfs mounts and do their timer
* queues.
*/
- for (mp = mountlist.cqh_first; mp != (void *)&mountlist;
- mp = mp->mnt_list.cqe_next) {
-#ifdef __NetBSD__
- if (!strcmp(&mp->mnt_stat.f_fstypename[0], MOUNT_NFS)) {
-#else
- if (mp->mnt_stat.f_fsid.val[1] == MOUNT_NFS) {
-#endif
+ simple_lock(&mountlist_slock);
+ for (mp = mountlist.cqh_first; mp != (void *)&mountlist; mp = nxtmp) {
+ if (vfs_busy(mp, LK_NOWAIT, &mountlist_slock, p)) {
+ nxtmp = mp->mnt_list.cqe_next;
+ continue;
+ }
+ if (mp->mnt_stat.f_type == nfs_mount_type) {
nmp = VFSTONFS(mp);
if (nmp->nm_flag & NFSMNT_NQNFS) {
for (np = nmp->nm_timerhead.cqh_first;
@@ -1213,7 +1211,11 @@ nqnfs_lease_updatetime(deltat)
}
}
}
+ simple_lock(&mountlist_slock);
+ nxtmp = mp->mnt_list.cqe_next;
+ vfs_unbusy(mp, p);
}
+ simple_unlock(&mountlist_slock);
}
/*
OpenPOWER on IntegriCloud