Commit 86ed1c88 authored by Steven Rostedt's avatar Steven Rostedt Committed by Thomas Gleixner

rt-locks: implement rt_downgrade_write

The current code of rt_downgrade_write simply does a BUG(). There
are places in the kernel that uses this code, and will crash a runnning
preempt-rt kernel.

The rt_downgrade_write converts a rwsem held for write into a rwsem
held for read without ever releasing the semaphore. In -rt, the rwsems
are simply a mutex. There is nothing different between a rwsem held
for write, and one held for read. The difference is that one held for
read can nest.

This patch changes the BUG_ON() to simply BUG if the caller is not
the owner of the semaphore.

This patch comes from my rt-git repo, and has been tested there.
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Clark Williams <clark.williams@gmail.com>
Cc: "Luis Claudio R. Goncalves" <lclaudio@uudg.org>
LKML-Reference: <alpine.DEB.2.00.0904151142420.31828@gandalf.stny.rr.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 4981ddc6
......@@ -315,7 +315,7 @@ EXPORT_SYMBOL(rt_up_read);
*/
void rt_downgrade_write(struct rw_semaphore *rwsem)
{
BUG();
BUG_ON(rt_mutex_real_owner(&rwsem->lock) != current);
}
EXPORT_SYMBOL(rt_downgrade_write);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment