Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=705962ccc9d21a08b74b6b6e1d3cf10f98968a67
Commit:     705962ccc9d21a08b74b6b6e1d3cf10f98968a67
Parent:     39403865d2e4590802553370a56c9ab93131e4ee
Author:     Al Viro <[EMAIL PROTECTED]>
AuthorDate: Sun May 13 05:52:32 2007 -0400
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Sun May 13 09:44:05 2007 -0700

    fix deadlock in loop.c
    
    ... doh
    
    Jeremy Fitzhardinge noted that the recent loop.c cleanups worked, but
    cause lockdep to complain.
    
    Ouch.  OK, the deadlock is real and yes, I'm an idiot.  Speaking of which,
    we probably want to s/lock/pin/ in drivers/base/map.c to avoid such
    brainos again.  And yes, this stuff needs clear documentation.  Will try
    to put one together once I get some sleep...
    
    Signed-off-by: Al Viro <[EMAIL PROTECTED]>
    Cc: Jeremy Fitzhardinge <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/block/loop.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index e2fc4b6..5526ead 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1399,6 +1399,11 @@ static struct loop_device *loop_init_one(int i)
        struct loop_device *lo;
        struct gendisk *disk;
 
+       list_for_each_entry(lo, &loop_devices, lo_list) {
+               if (lo->lo_number == i)
+                       return lo;
+       }
+
        lo = kzalloc(sizeof(*lo), GFP_KERNEL);
        if (!lo)
                goto out;
@@ -1443,17 +1448,13 @@ static void loop_del_one(struct loop_device *lo)
        kfree(lo);
 }
 
-static int loop_lock(dev_t dev, void *data)
-{
-       mutex_lock(&loop_devices_mutex);
-       return 0;
-}
-
 static struct kobject *loop_probe(dev_t dev, int *part, void *data)
 {
-       struct loop_device *lo = loop_init_one(dev & MINORMASK);
+       struct loop_device *lo;
        struct kobject *kobj;
 
+       mutex_lock(&loop_devices_mutex);
+       lo = loop_init_one(dev & MINORMASK);
        kobj = lo ? get_disk(lo->lo_disk) : ERR_PTR(-ENOMEM);
        mutex_unlock(&loop_devices_mutex);
 
@@ -1466,7 +1467,7 @@ static int __init loop_init(void)
        if (register_blkdev(LOOP_MAJOR, "loop"))
                return -EIO;
        blk_register_region(MKDEV(LOOP_MAJOR, 0), 1UL << MINORBITS,
-                                 THIS_MODULE, loop_probe, loop_lock, NULL);
+                                 THIS_MODULE, loop_probe, NULL, NULL);
 
        if (max_loop) {
                printk(KERN_INFO "loop: the max_loop option is obsolete "
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to