diff options
author | ps <ps@FreeBSD.org> | 2005-11-03 07:42:15 +0000 |
---|---|---|
committer | ps <ps@FreeBSD.org> | 2005-11-03 07:42:15 +0000 |
commit | 7b692a9f88856b47041ab527eb8f5d377245661b (patch) | |
tree | 1c8c30bb37c18dfd43f73279b41808f8e06a79fb /sys | |
parent | 9becb28959774b92c1ece2c9d9d296a269ff33d3 (diff) | |
download | FreeBSD-src-7b692a9f88856b47041ab527eb8f5d377245661b.zip FreeBSD-src-7b692a9f88856b47041ab527eb8f5d377245661b.tar.gz |
In nfs_flush(), clear the NMODIFIED bit only if there are no dirty
buffers *and* there are no buffers queued up for writing. The bug
was that NMODIFIED was being cleared even while there were buffers
scheduled to be written out, which leads to all sorts of interesting
bugs - one where the file could shrink (because of a post-op getattr
load, say) causing data in buffer(s) queued for write to be tossed,
resulting in data corruption.
Submitted by: Mohan Srinivasan
Diffstat (limited to 'sys')
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index d5ea209..efeb8bc 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -2881,7 +2881,8 @@ loop: error = np->n_error; np->n_flag &= ~NWRITEERR; } - if (commit && vp->v_bufobj.bo_dirty.bv_cnt == 0) + if (commit && vp->v_bufobj.bo_dirty.bv_cnt == 0 && + vp->v_bufobj.bo_numoutput == 0) np->n_flag &= ~NMODIFIED; done: if (bvec != NULL && bvec != bvec_on_stack) |