mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-22 16:44:32 +01:00
Fix a braino in the v_id wraparound code. Give more (current) details
in comment. PR: 11307 Spotted by: Ville-Pertti Keinonen <will@iki.fi>
This commit is contained in:
parent
cf69fad236
commit
22f054e258
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=46011
@ -34,7 +34,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)vfs_cache.c 8.5 (Berkeley) 3/22/95
|
* @(#)vfs_cache.c 8.5 (Berkeley) 3/22/95
|
||||||
* $Id: vfs_cache.c,v 1.37 1997/12/19 23:18:37 bde Exp $
|
* $Id: vfs_cache.c,v 1.38 1998/09/09 07:41:41 bde Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -318,13 +318,21 @@ nchinit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Invalidate all entries to particular vnode.
|
* Invalidate all entries to a particular vnode.
|
||||||
*
|
*
|
||||||
* We actually just increment the v_id, that will do it. The stale entries
|
* Remove all entries in the namecache relating to this vnode and
|
||||||
* will be purged by lookup as they get found. If the v_id wraps around, we
|
* change the v_id. We take the v_id from a global counter, since
|
||||||
* need to ditch the entire cache, to avoid confusion. No valid vnode will
|
* it becomes a handy sequence number in crash-dumps that way.
|
||||||
* ever have (v_id == 0).
|
* No valid vnode will ever have (v_id == 0).
|
||||||
|
*
|
||||||
|
* XXX: Only time and the size of v_id prevents this from failing:
|
||||||
|
* XXX: In theory we should hunt down all (struct vnode*, v_id)
|
||||||
|
* XXX: soft references and nuke them, at least on the global
|
||||||
|
* XXX: v_id wraparound. The period of resistance can be extended
|
||||||
|
* XXX: by incrementing each vnodes v_id individually instead of
|
||||||
|
* XXX: using the global v_id.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
cache_purge(vp)
|
cache_purge(vp)
|
||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
@ -336,9 +344,9 @@ cache_purge(vp)
|
|||||||
while (!TAILQ_EMPTY(&vp->v_cache_dst))
|
while (!TAILQ_EMPTY(&vp->v_cache_dst))
|
||||||
cache_zap(TAILQ_FIRST(&vp->v_cache_dst));
|
cache_zap(TAILQ_FIRST(&vp->v_cache_dst));
|
||||||
|
|
||||||
nextid++;
|
do
|
||||||
while (nextid == vp->v_id || !nextid)
|
nextid++;
|
||||||
continue;
|
while (nextid == vp->v_id || !nextid);
|
||||||
vp->v_id = nextid;
|
vp->v_id = nextid;
|
||||||
vp->v_dd = vp;
|
vp->v_dd = vp;
|
||||||
vp->v_ddid = 0;
|
vp->v_ddid = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user