Re: multiple loop-mounts of the same fs-file

Franck Lesage (lesage@lirskynet.insa-rouen.fr)
Mon, 30 Mar 1998 16:40:24 +0200 (MET DST)


> > Franck Lesage <lesage@lirskynet.insa-rouen.fr> writes:
> >
> > |> Hello,
> > |> I tried to mount an ext2 fs-file with the loop feature under 2.0.33.
> > |> I typed 'mount -t ext2 -o loop blah /mnt' and 'mount -t ext2 -o loop blah /a'
> > |> ok, they both appear in /proc/mounts :
> >
> > IMHO this should be disallowed in the first place (just like mounting a
> > block device twice). Then the other things are non-issues.
>
> Ok, maybe the following patch does it ... :-) (tested on 2.0.33 and
> worked well)

Quoting myself .. whee. Just re-read and found it lame , here is the
modified patch:

--- linux/drivers/block/loop.c Tue Aug 12 22:06:54 1997
+++ /usr/src/linux/drivers/block/loop.c Mon Mar 30 16:38:28 1998
@@ -286,6 +286,7 @@
{
struct file *file;
struct inode *inode;
+ int i;

if (arg >= NR_OPEN || !(file = current->files->fd[arg]))
return -EBADF;
@@ -296,6 +297,9 @@
printk("loop_set_fd: NULL inode?!?\n");
return -EINVAL;
}
+ for( i=0; i < MAX_LOOP ; i++ )
+ if ( loop_dev[i].lo_inode == inode )
+ return -EBUSY;
if (S_ISBLK(inode->i_mode)) {
int error = blkdev_open(inode, file);
if (error)

Regards,
Franck

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu