[PATCH v3] lock/semaphore: Avoid an unnecessary deadlock within up()

From: Byungchul Park
Date: Wed Feb 17 2016 - 04:12:42 EST


change from v2 to v3
- the way to solve it in v2 is racy, so I changed the approach entirely.
- just make semaphore's trylock use spinlock's trylock.

change from v1 to v2
- remove unnecessary overhead by the redundant spin(un)lock.

Since I faced a infinite recursive printk() bug, I've tried to propose
patches the title of which is "lib/spinlock_debug.c: prevent a recursive
cycle in the debug code". But I noticed the root problem cannot be fixed
by that, through some discussion thanks to Sergey and Peter. So I focused
on preventing the deadlock.

-----8<-----