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@
-/* $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 $ */
/*
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;
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);
}
* 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);
}
-/* $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 $ */
/*
/*
* 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);
-/* $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 $ */
/*
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 *);
-/* $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 $ */
/*
}
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;
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;
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) {
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;
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) {
* 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,