Add a VNASSERT to vn_close to detect if v_writecount is going
to become negative. This will detect the underflow when it happens, instead of having it discovered when the vnode is taken off the freelist, long after the offending process is long gone.
This commit is contained in:
parent
08bf8bb7c1
commit
87aabdc126
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=166674
@ -285,8 +285,11 @@ vn_close(vp, flags, file_cred, td)
|
||||
|
||||
vn_start_write(vp, &mp, V_WAIT);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
if (flags & FWRITE)
|
||||
if (flags & FWRITE) {
|
||||
VNASSERT(vp->v_writecount > 0, vp,
|
||||
("vn_close: negative writecount"));
|
||||
vp->v_writecount--;
|
||||
}
|
||||
error = VOP_CLOSE(vp, flags, file_cred, td);
|
||||
vput(vp);
|
||||
vn_finished_write(mp);
|
||||
|
Loading…
Reference in New Issue
Block a user