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
This commit is contained in:
parent
6e7a7ba194
commit
41ce2892bb
@ -2881,7 +2881,8 @@ nfs_flush(struct vnode *vp, int waitfor, struct thread *td,
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user