mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gustavo Padovan <padovan@profusion.mobi>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mount: enable use MS_RDONLY with MS_BIND
Date: Fri, 23 Dec 2011 15:18:19 -0200	[thread overview]
Message-ID: <20111223171819.GB5287@joana> (raw)
In-Reply-To: <1324660497-23100-1-git-send-email-padovan@profusion.mobi>

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

           reply	other threads:[~2011-12-23 17:17 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1324660497-23100-1-git-send-email-padovan@profusion.mobi>]

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=20111223171819.GB5287@joana \
    --to=padovan@profusion.mobi \
    --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®