summaryrefslogtreecommitdiff
path: root/sys/nfs/nfs_kq.c
diff options
context:
space:
mode:
authorThordur I. Bjornsson <thib@cvs.openbsd.org>2007-04-12 18:21:20 +0000
committerThordur I. Bjornsson <thib@cvs.openbsd.org>2007-04-12 18:21:20 +0000
commitfac2c1d7b8b147c28e3ef82befa2f2a4dfbf6adc (patch)
tree5420ce67392d02e949bf6927cb153047d6a8cbdc /sys/nfs/nfs_kq.c
parent6dd488ce971a4b25923a4494a013502e05763686 (diff)
If VOP_GETATTR() in the nfs_kqpoll() loop returns ESTALE, catch it.
Not doing so can lead to clients missing out if the file is for example removed on the server and the client is doing a 'tail -f' on it. If it returns ESTALE, mark the file deleted and proceed to handling the next entry. ok tedu@,art@
Diffstat (limited to 'sys/nfs/nfs_kq.c')
-rw-r--r--sys/nfs/nfs_kq.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/nfs/nfs_kq.c b/sys/nfs/nfs_kq.c
index 3961f913405..6a02b57b529 100644
--- a/sys/nfs/nfs_kq.c
+++ b/sys/nfs/nfs_kq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_kq.c,v 1.2 2005/11/19 02:18:01 pedro Exp $ */
+/* $OpenBSD: nfs_kq.c,v 1.3 2007/04/12 18:21:19 thib Exp $ */
/* $NetBSD: nfs_kq.c,v 1.7 2003/10/30 01:43:10 simonb Exp $ */
/*-
@@ -107,6 +107,7 @@ nfs_kqpoll(void *arg)
struct vattr attr;
struct proc *p = pnfskq;
u_quad_t osize;
+ int error;
for(;;) {
lockmgr(&nfskevq_lock, LK_EXCLUSIVE, NULL);
@@ -131,7 +132,12 @@ nfs_kqpoll(void *arg)
/* save v_size, nfs_getattr() updates it */
osize = np->n_size;
- (void) VOP_GETATTR(ke->vp, &attr, p->p_ucred, p);
+ error = VOP_GETATTR(ke->vp, &attr, p->p_ucred, p);
+ if (error == ESTALE) {
+ np->n_attrstamp = 0;
+ VN_KNOTE(ke->vp, NOTE_DELETE);
+ goto next;
+ }
/* following is a bit fragile, but about best
* we can get */
@@ -157,6 +163,7 @@ nfs_kqpoll(void *arg)
ke->onlink = attr.va_nlink;
}
+next:
lockmgr(&nfskevq_lock, LK_EXCLUSIVE, NULL);
ke->flags &= ~KEVQ_BUSY;
if (ke->flags & KEVQ_WANT) {