Use msleep instead of mtx_exit; tsleep; mtx_enter, which is not safe.
This commit is contained in:
parent
21ad98bca8
commit
96fde7da19
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=69432
@ -186,9 +186,8 @@ acquire(struct lock *lkp, int extflags, int wanted) {
|
||||
while ((lkp->lk_flags & wanted) != 0) {
|
||||
lkp->lk_flags |= LK_WAIT_NONZERO;
|
||||
lkp->lk_waitcount++;
|
||||
mtx_exit(lkp->lk_interlock, MTX_DEF);
|
||||
error = tsleep(lkp, lkp->lk_prio, lkp->lk_wmesg, lkp->lk_timo);
|
||||
mtx_enter(lkp->lk_interlock, MTX_DEF);
|
||||
error = msleep(lkp, lkp->lk_interlock, lkp->lk_prio,
|
||||
lkp->lk_wmesg, lkp->lk_timo);
|
||||
if (lkp->lk_waitcount == 1) {
|
||||
lkp->lk_flags &= ~LK_WAIT_NONZERO;
|
||||
lkp->lk_waitcount = 0;
|
||||
@ -502,10 +501,8 @@ acquiredrain(struct lock *lkp, int extflags) {
|
||||
|
||||
while (lkp->lk_flags & LK_ALL) {
|
||||
lkp->lk_flags |= LK_WAITDRAIN;
|
||||
mtx_exit(lkp->lk_interlock, MTX_DEF);
|
||||
error = tsleep(&lkp->lk_flags, lkp->lk_prio,
|
||||
error = msleep(&lkp->lk_flags, lkp->lk_interlock, lkp->lk_prio,
|
||||
lkp->lk_wmesg, lkp->lk_timo);
|
||||
mtx_enter(lkp->lk_interlock, MTX_DEF);
|
||||
if (error)
|
||||
return error;
|
||||
if (extflags & LK_SLEEPFAIL) {
|
||||
|
Loading…
Reference in New Issue
Block a user