Re: [BUG] scsi/io-elevator held lock freed.

From: Arjan van de Ven
Date: Tue Jul 04 2006 - 11:12:03 EST


On Tue, 2006-07-04 at 07:54 -0700, Daniel Walker wrote:
> I got this during boot. I booted the same kernel several times, and only
> saw it once. The kernel was 2.6.17-mm5 .
>
> Daniel
>
>
> =========================
> [ BUG: held lock freed! ]
> -------------------------
> swapper/1 is freeing memory f73a8580-f73a867f, with a lock still held there!
> 2 locks held by swapper/1:
> #0: (&shost->scan_mutex){--..}, at: [<c0419098>] mutex_lock+0x8/0x10
> #1: (&eq->sysfs_lock){--..}, at: [<c0419098>] mutex_lock+0x8/0x10

blargh.. it'd be more useful if lockdep actually printed which lock it
is that it thinks is about to get freed.....

this patch ought to make it do that; could you at least add this to your
kernel?

Ingo, is this the right approach?

---
kernel/lockdep.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6.17-mm6/kernel/lockdep.c
===================================================================
--- linux-2.6.17-mm6.orig/kernel/lockdep.c
+++ linux-2.6.17-mm6/kernel/lockdep.c
@@ -2571,7 +2571,7 @@ static inline int in_range(const void *s

static void
print_freed_lock_bug(struct task_struct *curr, const void *mem_from,
- const void *mem_to)
+ const void *mem_to, struct held_lock *hlock)
{
if (!debug_locks_off())
return;
@@ -2583,6 +2583,7 @@ print_freed_lock_bug(struct task_struct
printk( "-------------------------\n");
printk("%s/%d is freeing memory %p-%p, with a lock still held there!\n",
curr->comm, curr->pid, mem_from, mem_to-1);
+ print_lock(hlock);
lockdep_print_held_locks(curr);

printk("\nstack backtrace:\n");
@@ -2616,7 +2617,7 @@ void debug_check_no_locks_freed(const vo
!in_range(mem_from, lock_to, mem_to))
continue;

- print_freed_lock_bug(curr, mem_from, mem_to);
+ print_freed_lock_bug(curr, mem_from, mem_to, hlock);
break;
}
local_irq_restore(flags);


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/