futex: clean up futex_(un)lock_pi fault handling

Impact: cleanup

Some apparently left over cruft code was complicating the fault logic:

Testing if uval != -EFAULT doesn't have any meaning, get_user() sets ret
to either 0 or -EFAULT, there's no need to compare uval, especially not
against EFAULT which it will never be.  This patch removes the superfluous
test and clarifies the comment blocks.

Build and boot tested on an 8way x86_64 system.

Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Darren Hart 2008-12-18 15:06:34 -08:00 committed by Ingo Molnar
parent 73500ac545
commit b56863630d

View file

@ -1565,12 +1565,11 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared,
uaddr_faulted: uaddr_faulted:
/* /*
* We have to r/w *(int __user *)uaddr, but we can't modify it * We have to r/w *(int __user *)uaddr, and we have to modify it
* non-atomically. Therefore, if get_user below is not * atomically. Therefore, if we continue to fault after get_user()
* enough, we need to handle the fault ourselves, while * below, we need to handle the fault ourselves, while still holding
* still holding the mmap_sem. * the mmap_sem. This can occur if the uaddr is under contention as
* * we have to drop the mmap_sem in order to call get_user().
* ... and hb->lock. :-) --ANK
*/ */
queue_unlock(&q, hb); queue_unlock(&q, hb);
@ -1582,7 +1581,7 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared,
} }
ret = get_user(uval, uaddr); ret = get_user(uval, uaddr);
if (!ret && (uval != -EFAULT)) if (!ret)
goto retry; goto retry;
if (to) if (to)
@ -1676,12 +1675,11 @@ static int futex_unlock_pi(u32 __user *uaddr, int fshared)
pi_faulted: pi_faulted:
/* /*
* We have to r/w *(int __user *)uaddr, but we can't modify it * We have to r/w *(int __user *)uaddr, and we have to modify it
* non-atomically. Therefore, if get_user below is not * atomically. Therefore, if we continue to fault after get_user()
* enough, we need to handle the fault ourselves, while * below, we need to handle the fault ourselves, while still holding
* still holding the mmap_sem. * the mmap_sem. This can occur if the uaddr is under contention as
* * we have to drop the mmap_sem in order to call get_user().
* ... and hb->lock. --ANK
*/ */
spin_unlock(&hb->lock); spin_unlock(&hb->lock);
@ -1694,7 +1692,7 @@ static int futex_unlock_pi(u32 __user *uaddr, int fshared)
} }
ret = get_user(uval, uaddr); ret = get_user(uval, uaddr);
if (!ret && (uval != -EFAULT)) if (!ret)
goto retry; goto retry;
return ret; return ret;