lkml.org 
[lkml]   [2008]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] lockdep: comment hidden releases of graph_lock

While reviewing the lockdep.c code, it looked to me that I found a bug where
the release of the graph_lock was not done on failure. This turns out not
to be the case, because the graph_unlock is performed within the internal
functions of lockdep when a failure occurs.

To help out others when visually reviewing this code, I've added comments
to the places where it looks like it may be a bug not to call graph_unlock.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/lockdep.c | 3 +++
1 file changed, 3 insertions(+)

Index: linux-sched-devel.git/kernel/lockdep.c
===================================================================
--- linux-sched-devel.git.orig/kernel/lockdep.c 2008-04-17 10:52:40.000000000 -0400
+++ linux-sched-devel.git/kernel/lockdep.c 2008-04-17 11:20:49.000000000 -0400
@@ -1566,6 +1566,7 @@ static int validate_chain(struct task_st
/*
* Add dependency only if this lock is not the head
* of the chain, and if it's not a secondary read-lock:
+ * (will do graph_unlock on failure)
*/
if (!chain_head && ret != 2)
if (!check_prevs_add(curr, hlock))
@@ -2284,6 +2285,7 @@ static int mark_lock(struct task_struct

this->class->usage_mask |= new_mask;

+ /* save_trace does graph_unlock on failure */
if (!save_trace(this->class->usage_traces + new_bit))
return 0;

@@ -2296,6 +2298,7 @@ static int mark_lock(struct task_struct
case LOCK_ENABLED_SOFTIRQS:
case LOCK_ENABLED_HARDIRQS_READ:
case LOCK_ENABLED_SOFTIRQS_READ:
+ /* mark_lock_irq does graph_unlock on failure */
ret = mark_lock_irq(curr, this, new_bit);
if (!ret)
return 0;


\
 
 \ /
  Last update: 2008-04-17 17:45    [W:2.111 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site