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

Franck Lesage (lesage@lirskynet.insa-rouen.fr)
Mon, 30 Mar 1998 16:10:19 +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)

*** linux/drivers/block/loop.c Tue Aug 12 22:06:54 1997
--- /usr/src/linux/drivers/block/loop.c Mon Mar 30 16:08:24 1998
***************
*** 286,297 ****
--- 286,301 ----
{
struct file *file;
struct inode *inode;
+ register int i;

if (arg >= NR_OPEN || !(file = current->files->fd[arg]))
return -EBADF;
if (lo->lo_inode)
return -EBUSY;
inode = file->f_inode;
+ for( i=0; i < MAX_LOOP ; i++ )
+ if ( loop_dev[i].lo_inode == inode )
+ return -EBUSY;
if (!inode) {
printk("loop_set_fd: NULL inode?!?\n");
return -EINVAL;

Regards,
Franck

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