summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/nfs/nfs_bio.c56
-rw-r--r--sys/nfs/nfs_node.c4
-rw-r--r--sys/nfs/nfs_var.h5
-rw-r--r--sys/nfs/nfs_vnops.c20
4 files changed, 36 insertions, 49 deletions
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c
index a1b57fce2b6..18c7690e422 100644
--- a/sys/nfs/nfs_bio.c
+++ b/sys/nfs/nfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_bio.c,v 1.54 2008/08/08 20:44:38 blambert Exp $ */
+/* $OpenBSD: nfs_bio.c,v 1.55 2008/08/09 10:14:02 thib Exp $ */
/* $NetBSD: nfs_bio.c,v 1.25.4.2 1996/07/08 20:47:04 jtc Exp $ */
/*
@@ -122,7 +122,7 @@ nfs_bioread(vp, uio, ioflag, cred)
if (error)
return (error);
if (np->n_mtime != vattr.va_mtime.tv_sec) {
- error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1);
+ error = nfs_vinvalbuf(vp, V_SAVE, cred, p);
if (error)
return (error);
np->n_mtime = vattr.va_mtime.tv_sec;
@@ -306,7 +306,7 @@ nfs_write(v)
if (ioflag & (IO_APPEND | IO_SYNC)) {
if (np->n_flag & NMODIFIED) {
np->n_attrstamp = 0;
- error = nfs_vinvalbuf(vp, V_SAVE, cred, p, 1);
+ error = nfs_vinvalbuf(vp, V_SAVE, cred, p);
if (error)
return (error);
}
@@ -481,57 +481,45 @@ nfs_getcacheblk(vp, bn, size, p)
* doing the flush, just wait for completion.
*/
int
-nfs_vinvalbuf(vp, flags, cred, p, intrflg)
- struct vnode *vp;
- int flags;
- struct ucred *cred;
- struct proc *p;
- int intrflg;
+nfs_vinvalbuf(struct vnode *vp, int flags, struct ucred *cred, struct proc *p)
{
- struct nfsnode *np = VTONFS(vp);
- struct nfsmount *nmp = VFSTONFS(vp->v_mount);
- int error = 0, slpflag, slptimeo;
+ struct nfsmount *nmp= VFSTONFS(vp->v_mount);
+ struct nfsnode *np = VTONFS(vp);
+ int error, sintr, stimeo;
- if ((nmp->nm_flag & NFSMNT_INT) == 0)
- intrflg = 0;
- if (intrflg) {
- slpflag = PCATCH;
- slptimeo = 2 * hz;
- } else {
- slpflag = 0;
- slptimeo = 0;
+ error = sintr = stimeo = 0;
+
+ if (ISSET(nmp->nm_flag, NFSMNT_INT)) {
+ sintr = PCATCH;
+ stimeo = 2 * hz;
}
- /*
- * First wait for any other process doing a flush to complete.
- */
+
+ /* First wait for any other process doing a flush to complete. */
while (np->n_flag & NFLUSHINPROG) {
np->n_flag |= NFLUSHWANT;
- error = tsleep((caddr_t)&np->n_flag, PRIBIO + 2, "nfsvinval",
- slptimeo);
- if (error && intrflg && nfs_sigintr(nmp, (struct nfsreq *)0, p))
+ error = tsleep(&np->n_flag, PRIBIO|sintr, "nfsvinval", stimeo);
+ if (error && sintr && nfs_sigintr(nmp, NULL, p))
return (EINTR);
}
- /*
- * Now, flush as required.
- */
+ /* Now, flush as required. */
np->n_flag |= NFLUSHINPROG;
- error = vinvalbuf(vp, flags, cred, p, slpflag, 0);
+ error = vinvalbuf(vp, flags, cred, p, sintr, 0);
while (error) {
- if (intrflg && nfs_sigintr(nmp, (struct nfsreq *)0, p)) {
+ if (sintr && nfs_sigintr(nmp, NULL, p)) {
np->n_flag &= ~NFLUSHINPROG;
if (np->n_flag & NFLUSHWANT) {
np->n_flag &= ~NFLUSHWANT;
- wakeup((caddr_t)&np->n_flag);
+ wakeup(&np->n_flag);
}
return (EINTR);
}
- error = vinvalbuf(vp, flags, cred, p, 0, slptimeo);
+ error = vinvalbuf(vp, flags, cred, p, 0, stimeo);
}
np->n_flag &= ~(NMODIFIED | NFLUSHINPROG);
if (np->n_flag & NFLUSHWANT) {
np->n_flag &= ~NFLUSHWANT;
- wakeup((caddr_t)&np->n_flag);
+ wakeup(&np->n_flag);
}
return (0);
}
diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c
index c596139a32f..39027998851 100644
--- a/sys/nfs/nfs_node.c
+++ b/sys/nfs/nfs_node.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_node.c,v 1.41 2008/08/08 20:40:24 blambert Exp $ */
+/* $OpenBSD: nfs_node.c,v 1.42 2008/08/09 10:14:02 thib Exp $ */
/* $NetBSD: nfs_node.c,v 1.16 1996/02/18 11:53:42 fvdl Exp $ */
/*
@@ -178,7 +178,7 @@ nfs_inactive(v)
/*
* Remove the silly file that was rename'd earlier
*/
- (void) nfs_vinvalbuf(ap->a_vp, 0, sp->s_cred, p, 1);
+ nfs_vinvalbuf(ap->a_vp, 0, sp->s_cred, p);
nfs_removeit(sp);
crfree(sp->s_cred);
vrele(sp->s_dvp);
diff --git a/sys/nfs/nfs_var.h b/sys/nfs/nfs_var.h
index f7d27ac2d9a..5698cb54b2d 100644
--- a/sys/nfs/nfs_var.h
+++ b/sys/nfs/nfs_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_var.h,v 1.42 2008/06/14 00:23:26 thib Exp $ */
+/* $OpenBSD: nfs_var.h,v 1.43 2008/08/09 10:14:02 thib Exp $ */
/* $NetBSD: nfs_var.h,v 1.3 1996/02/18 11:53:54 fvdl Exp $ */
/*
@@ -47,8 +47,7 @@ struct nfs_diskless;
int nfs_bioread(struct vnode *, struct uio *, int, struct ucred *);
int nfs_write(void *);
struct buf *nfs_getcacheblk(struct vnode *, daddr64_t, int, struct proc *);
-int nfs_vinvalbuf(struct vnode *, int, struct ucred *, struct proc *,
- int);
+int nfs_vinvalbuf(struct vnode *, int, struct ucred *, struct proc *);
int nfs_asyncio(struct buf *);
int nfs_doio(struct buf *, struct proc *);
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index bbc567179fc..9391c5cdc3e 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vnops.c,v 1.100 2008/08/08 20:44:38 blambert Exp $ */
+/* $OpenBSD: nfs_vnops.c,v 1.101 2008/08/09 10:14:02 thib Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */
/*
@@ -398,8 +398,8 @@ nfs_open(v)
}
if (np->n_flag & NMODIFIED) {
- if ((error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
- ap->a_p, 1)) == EINTR)
+ error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p);
+ if (error == EINTR)
return (error);
uvm_vnp_uncache(vp);
np->n_attrstamp = 0;
@@ -416,8 +416,8 @@ nfs_open(v)
if (np->n_mtime != vattr.va_mtime.tv_sec) {
if (vp->v_type == VDIR)
np->n_direofoffset = 0;
- if ((error = nfs_vinvalbuf(vp, V_SAVE,
- ap->a_cred, ap->a_p, 1)) == EINTR)
+ error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p);
+ if (error == EINTR);
return (error);
uvm_vnp_uncache(vp);
np->n_mtime = vattr.va_mtime.tv_sec;
@@ -469,7 +469,7 @@ nfs_close(v)
error = nfs_flush(vp, ap->a_cred, MNT_WAIT, ap->a_p, 0);
np->n_flag &= ~NMODIFIED;
} else
- error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1);
+ error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p);
np->n_attrstamp = 0;
}
if (np->n_flag & NWRITEERR) {
@@ -570,10 +570,10 @@ nfs_setattr(v)
return (EROFS);
if (vap->va_size == 0)
error = nfs_vinvalbuf(vp, 0,
- ap->a_cred, ap->a_p, 1);
+ ap->a_cred, ap->a_p);
else
error = nfs_vinvalbuf(vp, V_SAVE,
- ap->a_cred, ap->a_p, 1);
+ ap->a_cred, ap->a_p);
if (error)
return (error);
tsize = np->n_size;
@@ -584,7 +584,7 @@ nfs_setattr(v)
vap->va_atime.tv_sec != VNOVAL) &&
vp->v_type == VREG &&
(error = nfs_vinvalbuf(vp, V_SAVE, ap->a_cred,
- ap->a_p, 1)) == EINTR)
+ ap->a_p)) == EINTR)
return (error);
error = nfs_setattrrpc(vp, vap, ap->a_cred, ap->a_p);
if (error && vap->va_size != VNOVAL) {
@@ -1396,7 +1396,7 @@ nfs_remove(v)
* throw away biocache buffers, mainly to avoid
* unnecessary delayed writes later.
*/
- error = nfs_vinvalbuf(vp, 0, cnp->cn_cred, cnp->cn_proc, 1);
+ error = nfs_vinvalbuf(vp, 0, cnp->cn_cred, cnp->cn_proc);
/* Do the rpc */
if (error != EINTR)
error = nfs_removerpc(dvp, cnp->cn_nameptr,