Properly reset the fields in clean_unrhdr.
In r324542 I neglected to reset the first and last fields of struct unrhdr. This causes a tmpfs to fail the unr(9) consistency checks with DIAGNOSTIC on. Fix this by resetting the fields by calling init_unrhdr. While here, change a loop to use TAILQ_FOREACH_SAFE since it is more readable and equally fast. Reported by: David Wolfskill <david@catwhisker.org> Approved by: rstone (mentor) Sponsored by: Dell EMC Isilon
This commit is contained in:
parent
ca1f624517
commit
0d8e04054e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=324666
@ -373,18 +373,17 @@ clear_unrhdr(struct unrhdr *uh)
|
||||
|
||||
KASSERT(TAILQ_EMPTY(&uh->ppfree),
|
||||
("unrhdr has postponed item for free"));
|
||||
up = TAILQ_FIRST(&uh->head);
|
||||
while (up != NULL) {
|
||||
uq = TAILQ_NEXT(up, list);
|
||||
TAILQ_FOREACH_SAFE(up, &uh->head, list, uq) {
|
||||
if (up->ptr != uh) {
|
||||
Free(up->ptr);
|
||||
}
|
||||
Free(up);
|
||||
up = uq;
|
||||
}
|
||||
TAILQ_INIT(&uh->head);
|
||||
uh->busy = 0;
|
||||
uh->alloc = 0;
|
||||
init_unrhdr(uh, uh->low, uh->high, uh->mtx);
|
||||
|
||||
check_unrhdr(uh, __LINE__);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
|
Loading…
Reference in New Issue
Block a user