[CRIU] [PATCHv2 1/4] mount: Add error messages

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Sun Nov 17 12:37:01 MSK 2019


Haven't you lost the "Unable to remount" hunk from v1? And maybe you can 
write "v2:..." comments so it would be easier to understand what's changed.

On 11/17/19 10:28 AM, Radostin Stoyanov wrote:
> Suggested-by: Andrei Vagin <avagin at gmail.com>
> Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
> ---
>   criu/mount.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/criu/mount.c b/criu/mount.c
> index 974af6eb2..301ba5d09 100644
> --- a/criu/mount.c
> +++ b/criu/mount.c
> @@ -1536,6 +1536,7 @@ static __maybe_unused int mount_cr_time_mount(struct ns_id *ns, unsigned int *s_
>   
>   	ret = mount(source, target, type, 0, NULL);
>   	if (ret < 0) {
> +		pr_perror("Unable to mount %s %s", source, target);
>   		exit_code = -errno;
>   		goto restore_ns;
>   	} else {
> @@ -2004,7 +2005,10 @@ static int fetch_rt_stat(struct mount_info *m, const char *where)
>   static int do_simple_mount(struct mount_info *mi, const char *src, const
>   			   char *fstype, unsigned long mountflags)
>   {
> -	return mount(src, mi->mountpoint, fstype, mountflags, mi->options);
> +	int ret = mount(src, mi->mountpoint, fstype, mountflags, mi->options);
> +	if (ret)
> +		pr_perror("Unable to mount %s %s (id=%d)", src, mi->mountpoint, mi->mnt_id);
> +	return ret;
>   }
>   
>   static char *mnt_fsname(struct mount_info *mi)
> @@ -2491,8 +2495,11 @@ static int do_mount_one(struct mount_info *mi)
>   		}
>   
>   		/* do_mount_root() is called from populate_mnt_ns() */
> -		if (mount(opts.root, mi->mountpoint, NULL, MS_BIND | MS_REC, NULL))
> +		if (mount(opts.root, mi->mountpoint, NULL, MS_BIND | MS_REC, NULL)) {
> +			pr_perror("Unable to mount %s %s (id=%d)", opts.root, mi->mountpoint, mi->mnt_id);
>   			return -1;
> +		}
> +
>   		if (do_mount_root(mi))
>   			return -1;
>   		mi->mounted = true;
> 

-- 
Best regards, Tikhomirov Pavel
Software Developer, Virtuozzo.



More information about the CRIU mailing list