summaryrefslogtreecommitdiff
path: root/sys/nfs/nfs_bio.c
diff options
context:
space:
mode:
authorThordur I. Bjornsson <thib@cvs.openbsd.org>2008-08-09 10:14:03 +0000
committerThordur I. Bjornsson <thib@cvs.openbsd.org>2008-08-09 10:14:03 +0000
commit438407ddf18815478fb586feb0444b01488e7c67 (patch)
treecf7dc174aed3bc3f033e99276ac5b355d6fcd144 /sys/nfs/nfs_bio.c
parent690491d0cc42772963d6764f43e2ffc506b42f15 (diff)
o nfs_vinvalbuf() is always called with the intrflag as 1, and then
checks if the mount is actually interrutable, and if not sets it 0. remove this argument from nfs_vinvalbuf and just do the checking inside the function. o give nfs_vinvalbuf() a makeover so it looks nice. (spacing, casts, &c); o Actually pass PCATCH too tsleep() if the mount it interrutable. ok art@, blambert@
Diffstat (limited to 'sys/nfs/nfs_bio.c')
-rw-r--r--sys/nfs/nfs_bio.c56
1 files changed, 22 insertions, 34 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);
}