Re: [PATCH] loopback device can't act as its backing store

From: Franz Pletz
Date: Fri Dec 03 2004 - 17:33:34 EST


On Fri, 3 Dec 2004 13:42:38 -0800, Phil Oester <kernel@xxxxxxxxxxxx> wrote:
> Your mailer mangled the patch.

Thanks for your feedback.
I apologize for any inconvenience at applying or evaluating the patch.

I think I got it now. Let's give it another try.


Signed-off-by: Franz Pletz <franz_pletz@xxxxxxxxxxx>

linux/drivers/block/loop.c | 7 +++++++
1 files changed, 7 insertions(+)

--- linux-2.6.10-rc2/drivers/block/loop.c 2004-11-25 19:56:32.000000000 +0100
+++ linux/drivers/block/loop.c 2004-12-02 23:39:43.516913144 +0100
@@ -596,6 +596,9 @@
old_file = lo->lo_backing_file;

error = -EINVAL;
+ /* new backing store mustn't be the loop device it's being mapped to */
+ if(inode->i_rdev == bdev->bd_dev)
+ goto out_putf;

if (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))
goto out_putf;
@@ -652,6 +655,10 @@
lo_flags |= LO_FLAGS_READ_ONLY;

error = -EINVAL;
+ /* new backing store mustn't be the loop device it's being mapped to */
+ if(inode->i_rdev == bdev->bd_dev)
+ goto out_putf;
+
if (S_ISREG(inode->i_mode) || S_ISBLK(inode->i_mode)) {
struct address_space_operations *aops = mapping->a_ops;
/*
-
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/