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

Franck Lesage (lesage@lirskynet.insa-rouen.fr)
Mon, 30 Mar 1998 20:19:39 +0200 (MET DST)


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

Well err ... just remembered inode is not sufficient for a check.

--- linux/drivers/block/loop.c Tue Aug 12 22:06:54 1997
+++ /usr/src/linux/drivers/block/loop.c Mon Mar 30 17:08:59 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,10 @@
printk("loop_set_fd: NULL inode?!?\n");
return -EINVAL;
}
+ for( i=0; i < MAX_LOOP ; i++ )
+ if ( (loop_dev[i].lo_inode == inode) &&
+ (loop_dev[i].lo_device == inode->i_dev) )
+ return -EBUSY;
if (S_ISBLK(inode->i_mode)) {
int error = blkdev_open(inode, file);
if (error)

I hope it is correct :-)

Franck

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