Make sure we get new m_owner value if we can not unlock it in
uncontested case. Reorder statements in do_unlock_umutex.
This commit is contained in:
parent
ee35caa0b3
commit
81273e0632
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=161855
@ -681,6 +681,7 @@ do_unlock(struct thread *td, struct umtx *umtx, uintptr_t id)
|
|||||||
return (EFAULT);
|
return (EFAULT);
|
||||||
if (old == owner)
|
if (old == owner)
|
||||||
return (0);
|
return (0);
|
||||||
|
owner = old;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We should only ever be in here for contested locks */
|
/* We should only ever be in here for contested locks */
|
||||||
@ -965,6 +966,7 @@ do_unlock_normal(struct thread *td, struct umutex *m, uint32_t flags)
|
|||||||
return (EFAULT);
|
return (EFAULT);
|
||||||
if (old == owner)
|
if (old == owner)
|
||||||
return (0);
|
return (0);
|
||||||
|
owner = old;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We should only ever be in here for contested locks */
|
/* We should only ever be in here for contested locks */
|
||||||
@ -1595,6 +1597,7 @@ do_unlock_pi(struct thread *td, struct umutex *m, uint32_t flags)
|
|||||||
return (EFAULT);
|
return (EFAULT);
|
||||||
if (old == owner)
|
if (old == owner)
|
||||||
return (0);
|
return (0);
|
||||||
|
owner = old;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We should only ever be in here for contested locks */
|
/* We should only ever be in here for contested locks */
|
||||||
@ -2005,20 +2008,21 @@ static int
|
|||||||
do_unlock_umutex(struct thread *td, struct umutex *m)
|
do_unlock_umutex(struct thread *td, struct umutex *m)
|
||||||
{
|
{
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
int ret;
|
|
||||||
|
|
||||||
flags = fuword32(&m->m_flags);
|
flags = fuword32(&m->m_flags);
|
||||||
if (flags == -1)
|
if (flags == -1)
|
||||||
return (EFAULT);
|
return (EFAULT);
|
||||||
|
|
||||||
if ((flags & UMUTEX_PRIO_INHERIT) != 0)
|
switch(flags & (UMUTEX_PRIO_INHERIT | UMUTEX_PRIO_PROTECT)) {
|
||||||
ret = do_unlock_pi(td, m, flags);
|
case 0:
|
||||||
else if ((flags & UMUTEX_PRIO_PROTECT) != 0)
|
return (do_unlock_normal(td, m, flags));
|
||||||
ret = do_unlock_pp(td, m, flags);
|
case UMUTEX_PRIO_INHERIT:
|
||||||
else
|
return (do_unlock_pi(td, m, flags));
|
||||||
ret = do_unlock_normal(td, m, flags);
|
case UMUTEX_PRIO_PROTECT:
|
||||||
|
return (do_unlock_pp(td, m, flags));
|
||||||
|
}
|
||||||
|
|
||||||
return (ret);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user