linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bind Mount Extensions (RO --bind mounts)
@ 2003-09-23 15:54 Herbert Poetzl
  0 siblings, 0 replies; 5+ messages in thread
From: Herbert Poetzl @ 2003-09-23 15:54 UTC (permalink / raw)
  To: Linux Kernel Mailing List


Hi All!

just verified that the patches still apply on  
linux-2.6.0-test5-bk9 and linux-2.4.23-pre5  
without any issues ...

FYI, this patch (hopefully) allows RO --bind mounts 
to 'behave' like other ro mounted filesystems ...

AFAIK, it handles the following cases as expected:

 - open (read/write/trunc), create
 - link, symlink, unlink
 - mknod (reg/block/char/fifo), mkfifo
 - mkdir, rmdir
 - (f)chown, (f)chmod, utimes
 - ioctl (gen/ext2/ext3/reiser)
 - access, truncate

it doesn't handle update_atime() yet (Al Viro is still
busy ;) and it doesn't change current intermezzo code 
(but this would be easy to add, because it's almost the 
same as the vfs_*()s at least regarding ro --bind mounts)

you can get them at:

http://vserver.13thfloor.at/Experimental/patch-2.4.22-rc2-bme0.03.diff
http://vserver.13thfloor.at/Experimental/patch-2.4.22-rc2-bme0.03.diff.bz2
http://vserver.13thfloor.at/Experimental/patch-2.6.0-test3-bme0.03.diff
http://vserver.13thfloor.at/Experimental/patch-2.6.0-test3-bme0.03.diff.bz2

enjoy,
Herbert



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bind Mount Extensions (RO --bind mounts)
  2004-03-09 10:45 Olivier ARCHER
@ 2004-03-09 11:32 ` Sean Neakums
  0 siblings, 0 replies; 5+ messages in thread
From: Sean Neakums @ 2004-03-09 11:32 UTC (permalink / raw)
  To: linux-kernel

Olivier ARCHER <olivier.archer@infini.fr> writes:

> Hi,
> 	I've tried
> http://www.ussg.iu.edu/hypermail/linux/kernel/0309.3/0802.html
> to try the 'Bind Mount Extensions (RO --bind mounts)'
>
> I've applied the patch on 2.4.24 and 2.6.3, without effects, ie
>
> mount -t ext2 -o ro /dev/hdc7 /mnt/ro
> mount --bind -o rw /mnt/ro /mnt/ro2rw
> touch  /mnt/ro2rw/test
> touch: connot touch '/mnt/ro2rw/test': Read Only file system
>
> have I miss something ?

As far as I can tell, you have it backwards.  BME seems to be designed
to enable you to do ro binds of an rw FS, not an rw bind of an ro FS.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Bind Mount Extensions (RO --bind mounts)
@ 2004-03-09 10:45 Olivier ARCHER
  2004-03-09 11:32 ` Sean Neakums
  0 siblings, 1 reply; 5+ messages in thread
From: Olivier ARCHER @ 2004-03-09 10:45 UTC (permalink / raw)
  To: linux-kernel

Hi,
	I've tried
http://www.ussg.iu.edu/hypermail/linux/kernel/0309.3/0802.html
to try the 'Bind Mount Extensions (RO --bind mounts)'

I've applied the patch on 2.4.24 and 2.6.3, without effects, ie

mount -t ext2 -o ro /dev/hdc7 /mnt/ro
mount --bind -o rw /mnt/ro /mnt/ro2rw
touch  /mnt/ro2rw/test
touch: connot touch '/mnt/ro2rw/test': Read Only file system

have I miss something ?

curently, i'm running up-to date debian unstable with mount-2.12 and a 
patched version ( 
http://vserver.13thfloor.at/Experimental/patch-2.6.0-test3-bme0.03.diff) 
  of 2.6.3

BTW, is this patch could work on NFS RO mounts ? I'm very interressted 
in it because y try to mount / from nfs RO. I've got some success with 
http://translucency.sourceforge.net/, But I'd would like test others 
approach.

Thx

--
Olivier


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bind Mount Extensions (RO --bind mounts)
       [not found] ` <20030929111941.GG11543@vega.digitel2002.hu>
@ 2003-09-29 16:20   ` Herbert Poetzl
  0 siblings, 0 replies; 5+ messages in thread
From: Herbert Poetzl @ 2003-09-29 16:20 UTC (permalink / raw)
  To: Gábor Lénárt; +Cc: Linux Kernel Mailing List

On Mon, Sep 29, 2003 at 01:19:41PM +0200, Gábor Lénárt wrote:
> tatus: O
> Content-Length: 1317
> Lines: 31
> 
> Hi!
> 
> On Sun, Sep 28, 2003 at 05:55:15PM +0200, Herbert Poetzl wrote:
> > verified that the patches apply on linux-2.6.0-test6
> > and work as expected ...
> > 
> > FYI, this patch (hopefully) allows RO --bind mounts
> > to 'behave' like other ro mounted filesystems, and
> > I hope that they will be included in the mainline
> > in the near future ;)
> 
> Maybe (sure ;-) it will be somewhat newbie question ...

you are welcome to ask!

> I don't know too much on kernel internals, but imho --bind 
> mounts and likes should be implemented at VFS layer. 

yes they are

> So then why the patch effects filesystems like ext2 and ext3? 

because ext2 and ext3 (and the other FS too) use them ;)

> Till now I've thought that VFS is a general layer, and syscalls 
> about file operations use general VFS functions which of course 
> call the desired functions from filesystem implementations to do a
> certain work. 

except for FS specific ioctls/features this is true ...

> If it's true (is it?) why not only VFS is needed to change to
> support eg ro --bind? 

hmm, IIRC I never mentioned any filesystem except intermezzo
which is a special case ...

> Does your patch mean that reiserfs or something else
> does not work with it? Because your patch contains filesystem 
> code modifications so I can inmagine that it won't work with 
> a great number of filesystems, like Minix, AFFS, msdos, etc etc ...

I've extracted the relevant hunks from the patch, and
you can see, that those FS specific modifications only
affect the FS specific ioctls, which do not use the
VFS layer (yet?) ... (at end of mail)

> BTW. It would be much more funny to have --bind mounts
> supporting all general mount options, like ro (ok so this is the patch),
> noexec, and such. 

yes, I will implement them, but until now, only a few
people seem to care about this stuff, so there seems
no hurry, but you are right, all the other mount features
should be implemented for --bind mounts too ...

best,
Herbert

--- linux-2.6.0-test3/fs/ext2/ioctl.c	2003-07-14 05:39:30.000000000 +0200
+++ linux-2.6.0-test3-bme0.03/fs/ext2/ioctl.c	2003-08-09 17:05:51.000000000 +0200
@@ -29,7 +30,7 @@
 	case EXT2_IOC_SETFLAGS: {
 		unsigned int oldflags;
 
-		if (IS_RDONLY(inode))
+		if (IS_RDONLY(inode) || MNT_IS_RDONLY(filp->f_vfsmnt))
 			return -EROFS;
 
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
@@ -68,7 +69,7 @@
 	case EXT2_IOC_SETVERSION:
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
 			return -EPERM;
-		if (IS_RDONLY(inode))
+		if (IS_RDONLY(inode) || MNT_IS_RDONLY(filp->f_vfsmnt))
 			return -EROFS;
 		if (get_user(inode->i_generation, (int *) arg))
 			return -EFAULT;	
--- linux-2.6.0-test3/fs/ext3/ioctl.c	2003-07-14 05:33:10.000000000 +0200
+++ linux-2.6.0-test3-bme0.03/fs/ext3/ioctl.c	2003-08-09 17:06:08.000000000 +0200
@@ -34,7 +35,7 @@
 		unsigned int oldflags;
 		unsigned int jflag;
 
-		if (IS_RDONLY(inode))
+		if (IS_RDONLY(inode) || MNT_IS_RDONLY(filp->f_vfsmnt))
 			return -EROFS;
 
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
@@ -110,7 +111,7 @@
 
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
 			return -EPERM;
-		if (IS_RDONLY(inode))
+		if (IS_RDONLY(inode) || MNT_IS_RDONLY(filp->f_vfsmnt))
 			return -EROFS;
 		if (get_user(generation, (int *) arg))
 			return -EFAULT;
--- linux-2.6.0-test3/fs/reiserfs/ioctl.c	2003-07-14 05:33:11.000000000 +0200
+++ linux-2.6.0-test3-bme0.03/fs/reiserfs/ioctl.c	2003-08-09 17:06:22.000000000 +0200
@@ -38,7 +39,7 @@
 		i_attrs_to_sd_attrs( inode, ( __u16 * ) &flags );
 		return put_user(flags, (int *) arg);
 	case REISERFS_IOC_SETFLAGS: {
-		if (IS_RDONLY(inode))
+		if (IS_RDONLY(inode) || MNT_IS_RDONLY(filp->f_vfsmnt))
 			return -EROFS;
 
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
@@ -70,7 +71,7 @@
 	case REISERFS_IOC_SETVERSION:
 		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
 			return -EPERM;
-		if (IS_RDONLY(inode))
+		if (IS_RDONLY(inode) || MNT_IS_RDONLY(filp->f_vfsmnt))
 			return -EROFS;
 		if (get_user(inode->i_generation, (int *) arg))
 			return -EFAULT;	


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Bind Mount Extensions (RO --bind mounts)
@ 2003-09-28 15:55 Herbert Poetzl
       [not found] ` <20030929111941.GG11543@vega.digitel2002.hu>
  0 siblings, 1 reply; 5+ messages in thread
From: Herbert Poetzl @ 2003-09-28 15:55 UTC (permalink / raw)
  To: Linux Kernel Mailing List


Greetings!

verified that the patches apply on linux-2.6.0-test6
and work as expected ...

FYI, this patch (hopefully) allows RO --bind mounts
to 'behave' like other ro mounted filesystems, and
I hope that they will be included in the mainline
in the near future ;)

AFAIK, it handles the following cases as expected:

 - open (read/write/trunc), create
 - link, symlink, unlink
 - mknod (reg/block/char/fifo), mkfifo
 - mkdir, rmdir
 - (f)chown, (f)chmod, utimes
 - ioctl (gen/ext2/ext3/reiser)
 - access, truncate

it doesn't handle update_atime() yet (Al Viro is still
busy ;) and it doesn't change current intermezzo code
(but this would be easy to add, because it's almost the
same as the vfs_*()s at least regarding ro --bind mounts)

you can get them at:

http://vserver.13thfloor.at/Experimental/patch-2.4.22-rc2-bme0.03.diff
http://vserver.13thfloor.at/Experimental/patch-2.4.22-rc2-bme0.03.diff.bz2
http://vserver.13thfloor.at/Experimental/patch-2.6.0-test3-bme0.03.diff
http://vserver.13thfloor.at/Experimental/patch-2.6.0-test3-bme0.03.diff.bz2

enjoy,
Herbert


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-03-09 11:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-23 15:54 Bind Mount Extensions (RO --bind mounts) Herbert Poetzl
2003-09-28 15:55 Herbert Poetzl
     [not found] ` <20030929111941.GG11543@vega.digitel2002.hu>
2003-09-29 16:20   ` Herbert Poetzl
2004-03-09 10:45 Olivier ARCHER
2004-03-09 11:32 ` Sean Neakums

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).