softdep_unmount: handle spurious wakeups

Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D29178
This commit is contained in:
Konstantin Belousov 2021-03-01 00:46:21 +02:00
parent fabbc3d879
commit d7e5e37416

View File

@ -2805,10 +2805,13 @@ softdep_unmount(mp)
ACQUIRE_LOCK(ump);
ump->softdep_flags |= FLUSH_EXIT;
wakeup(&ump->softdep_flushtd);
msleep(&ump->softdep_flags, LOCK_PTR(ump), PVM | PDROP,
"sdwait", 0);
while ((ump->softdep_flags & FLUSH_EXIT) != 0) {
msleep(&ump->softdep_flags, LOCK_PTR(ump), PVM,
"sdwait", 0);
}
KASSERT((ump->softdep_flags & FLUSH_EXIT) == 0,
("Thread shutdown failed"));
FREE_LOCK(ump);
}
/*