mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] mount: enable use MS_RDONLY with MS_BIND
       [not found] <1324660497-23100-1-git-send-email-padovan@profusion.mobi>
@ 2011-12-23 17:18 ` Gustavo Padovan
  0 siblings, 0 replies; only message in thread
From: Gustavo Padovan @ 2011-12-23 17:18 UTC (permalink / raw)
  To: linux-kernel

So I put Lennart's email wrong. Fixing it.

* Gustavo F. Padovan <padovan@profusion.mobi> [2011-12-23 15:14:56 -0200]:

> From: "Gustavo F. Padovan" <padovan@profusion.mobi>
> 
> This allow creation of read-only bind mounts in a single mount() call,
> instead of two.
> 
> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
> ---
>  fs/namespace.c |   11 ++++++++---
>  1 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/namespace.c b/fs/namespace.c
> index 5c07af8..c08c150 100644
> --- a/fs/namespace.c
> +++ b/fs/namespace.c
> @@ -1743,7 +1743,7 @@ static int do_change_type(struct path *path, int flag)
>   * do loopback mount.
>   */
>  static int do_loopback(struct path *path, char *old_name,
> -				int recurse)
> +						unsigned long flags)
>  {
>  	LIST_HEAD(umount_list);
>  	struct path old_path;
> @@ -1769,7 +1769,7 @@ static int do_loopback(struct path *path, char *old_name,
>  		goto out2;
>  
>  	err = -ENOMEM;
> -	if (recurse)
> +	if (flags & MS_REC)
>  		mnt = copy_tree(old_path.mnt, old_path.dentry, 0);
>  	else
>  		mnt = clone_mnt(old_path.mnt, old_path.dentry, 0);
> @@ -1782,7 +1782,12 @@ static int do_loopback(struct path *path, char *old_name,
>  		br_write_lock(&vfsmount_lock);
>  		umount_tree(mnt, 0, &umount_list);
>  		br_write_unlock(&vfsmount_lock);
> +		goto out2;
>  	}
> +
> +	if (flags & MS_RDONLY)
> +		path->mnt->mnt_flags |= MNT_READONLY;
> +
>  out2:
>  	unlock_mount(path);
>  	release_mounts(&umount_list);
> @@ -2338,7 +2343,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
>  		retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags,
>  				    data_page);
>  	else if (flags & MS_BIND)
> -		retval = do_loopback(&path, dev_name, flags & MS_REC);
> +		retval = do_loopback(&path, dev_name, flags);
>  	else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
>  		retval = do_change_type(&path, flags);
>  	else if (flags & MS_MOVE)
> -- 
> 1.7.6.4
> 

	Gustavo

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-12-23 17:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1324660497-23100-1-git-send-email-padovan@profusion.mobi>
2011-12-23 17:18 ` [PATCH] mount: enable use MS_RDONLY with MS_BIND Gustavo Padovan

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®