mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Poetzl <herbert@13thfloor.at>
To: "Gábor Lénárt" <lgb@lgb.hu>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Bind Mount Extensions (RO --bind mounts)
Date: Mon, 29 Sep 2003 18:20:04 +0200	[thread overview]
Message-ID: <20030929162004.GB21717@DUK2.13thfloor.at> (raw)
In-Reply-To: <20030929111941.GG11543@vega.digitel2002.hu>

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;	


  parent reply	other threads:[~2003-09-29 16:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-28 15:55 Herbert Poetzl
     [not found] ` <20030929111941.GG11543@vega.digitel2002.hu>
2003-09-29 16:20   ` Herbert Poetzl [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-03-09 10:45 Olivier ARCHER
2004-03-09 11:32 ` Sean Neakums
2003-09-23 15:54 Herbert Poetzl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030929162004.GB21717@DUK2.13thfloor.at \
    --to=herbert@13thfloor.at \
    --cc=lgb@lgb.hu \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®