From 8fefdf0057f1db0ea35545e2c37f995c14e264d2 Mon Sep 17 00:00:00 2001 From: Paul Saab Date: Mon, 6 Dec 2004 16:35:58 +0000 Subject: [PATCH] - If all data has been committed to stable storage on the server, it is safe to turn off the nfsnode's NMODIFIED flag. - Move the check for signals to the top of the loop where we loop around the dirty buffers on the vnode, scheduling writes. This ensures that we'll break ouf of the flush operation on reception of a signal. Submitted by: Mohan Srinivasan mohans at yahoo-inc dot com --- sys/nfsclient/nfs_vnops.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 48153d8481d..50e1496e40b 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -2815,6 +2816,10 @@ loop: s = splbio(); VI_LOCK(vp); TAILQ_FOREACH_SAFE(bp, &vp->v_bufobj.bo_dirty.bv_hd, b_bobufs, nbp) { + if (nfs_sigintr(nmp, NULL, td)) { + error = EINTR; + goto done; + } if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) { if (waitfor != MNT_WAIT || passone) continue; @@ -2827,9 +2832,6 @@ loop: panic("nfs_fsync: inconsistent lock"); if (error == ENOLCK) goto loop; - error = nfs_sigintr(nmp, NULL, td); - if (error) - goto done; if (slpflag == PCATCH) { slpflag = 0; slptimeo = 2 * hz; @@ -2883,6 +2885,8 @@ loop: error = np->n_error; np->n_flag &= ~NWRITEERR; } + if (commit && vp->v_bufobj.bo_dirty.bv_cnt == 0) + np->n_flag &= ~NMODIFIED; done: if (bvec != NULL && bvec != bvec_on_stack) free(bvec, M_TEMP);