[patch] lockdep: annotate pktcdvd natural device hierarchy

From: Arjan van de Ven
Date: Sat Jul 15 2006 - 03:06:15 EST



> So the claim from the lockdep code, "BUG: possible circular locking
> deadlock detected!", is a false alarm.

ok this patch ought to kill the false positive:


the pkt_*_dev functions operate on not-this-blockdevice, and that is
sufficiently checked at setup time. As a result there is a natural
hierarchy, which needs nesting annotations

Signed-off-by: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>

Index: linux-2.6.18-rc1/drivers/block/pktcdvd.c
===================================================================
--- linux-2.6.18-rc1.orig/drivers/block/pktcdvd.c
+++ linux-2.6.18-rc1/drivers/block/pktcdvd.c
@@ -2577,19 +2577,19 @@ static int pkt_ctl_ioctl(struct inode *i
case PKT_CTRL_CMD_SETUP:
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- mutex_lock(&ctl_mutex);
+ mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
ret = pkt_setup_dev(&ctrl_cmd);
mutex_unlock(&ctl_mutex);
break;
case PKT_CTRL_CMD_TEARDOWN:
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- mutex_lock(&ctl_mutex);
+ mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
ret = pkt_remove_dev(&ctrl_cmd);
mutex_unlock(&ctl_mutex);
break;
case PKT_CTRL_CMD_STATUS:
- mutex_lock(&ctl_mutex);
+ mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);
pkt_get_status(&ctrl_cmd);
mutex_unlock(&ctl_mutex);
break;

-
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/