[CRIU] [PATCH 1/2] mount: don't merge mnt and sb flags if only one contains MS_RDONLY

Tycho Andersen tycho.andersen at canonical.com
Tue Sep 22 08:23:31 PDT 2015


On Tue, Sep 22, 2015 at 11:59:52AM +0300, Andrey Vagin wrote:
> From: Andrew Vagin <avagin at openvz.org>
> 
> Reported-by: Tycho Andersen <tycho.andersen at canonical.com>

Tested-by: Tycho Andersen <tycho.andersen at canonical.com>

Thanks!

> Signed-off-by: Andrew Vagin <avagin at openvz.org>
> ---
>  mount.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/mount.c b/mount.c
> index 0bff365..b85515c 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -1958,15 +1958,15 @@ static int do_new_mount(struct mount_info *mi)
>  	if (!src)
>  		return -1;
>  
> -	if (remount_ro)
> -		sflags &= ~MS_RDONLY;
> -
>  	/* Merge superblock and mount flags if it's posiable */
> -	if (!(mflags & ~MS_MNT_KNOWN_FLAGS) && ((sflags ^ mflags) & MS_RDONLY)) {
> +	if (!(mflags & ~MS_MNT_KNOWN_FLAGS) && !((sflags ^ mflags) & MS_RDONLY)) {
>  		sflags |= mflags;
>  		mflags = 0;
>  	}
>  
> +	if (remount_ro)
> +		sflags &= ~MS_RDONLY;
> +
>  	if (mount(src, mi->mountpoint, tp->name, sflags, mi->options) < 0) {
>  		pr_perror("Can't mount at %s", mi->mountpoint);
>  		return -1;
> -- 
> 2.4.3
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list