Looback bugfix

Jan Kara (jack@suse.cz)
Mon, 3 Dec 2001 00:22:08 +0100


Hello,

I'm sending you a patch which should fix bug in loopback device - it
allows you to setup loopback /dev/loop0 -> /dev/loop0 with very unpleasant
(hard deadlock) results. The patch is against 2.4.16 but should apply well
against 2.5.0 too. Could oth of you apply the patch please?

Bye

Honza

--
Jan Kara <jack@suse.cz>
SuSE CR Labs

------- <cut> ---------

diff -ruX /home/jack/.kerndiffexclude linux-2.4.16/drivers/block/loop.c linux-2.4.16-loopfix/drivers/block/loop.c --- linux-2.4.16/drivers/block/loop.c Mon Nov 19 23:48:02 2001 +++ linux-2.4.16-loopfix/drivers/block/loop.c Sat Dec 1 00:07:39 2001 @@ -640,6 +640,10 @@ if (S_ISBLK(inode->i_mode)) { lo_device = inode->i_rdev; + if (lo_device == dev) { + error = -EBUSY; + goto out; + } } else if (S_ISREG(inode->i_mode)) { struct address_space_operations *aops = inode->i_mapping->a_ops; /* - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/