[CRIU] [PATCH 3/4] mount: fix comparison of stat.st_dev and mount_info->s_dev

Pavel Emelyanov xemul at parallels.com
Tue Apr 15 14:37:14 PDT 2014


On 04/15/2014 12:31 PM, Andrey Vagin wrote:
> st_dev and s_dev have different formats.
> st_dev is (MAJOR(dev) << 8) | MINOR(dev)
> s_dev is (MAJOR(dev) << 20) | MINOR(dev)
> 
> so we need to convert one of them
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  mount.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mount.c b/mount.c
> index adce76a..4b93858 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -502,7 +502,7 @@ static int __open_mountpoint(struct mount_info *pm, int mnt_fd)
>  		goto err;
>  	}
>  
> -	if (st.st_dev != pm->s_dev) {
> +	if (MKKDEV(MAJOR(st.st_dev), MINOR(st.st_dev)) != pm->s_dev) {

Isn't kdev_to_odev() suitable here? If yes, plz used one, it looks nicer
and easier to read and understand what's going on.

>  		pr_err("The file system %#x (%#x) %s %s is inaccessible\n",
>  				pm->s_dev, (int)st.st_dev, pm->fstype->name, pm->mountpoint);
>  		goto err;
> 




More information about the CRIU mailing list