[CRIU] [PATCH 2/3] mount: allow to dump content even if a part of fs is overmounted (v2)

Andrew Vagin avagin at parallels.com
Thu Aug 1 09:02:39 EDT 2013


On Thu, Aug 01, 2013 at 04:57:38PM +0400, Pavel Emelyanov wrote:
> > +	snprintf(buf, sizeof(buf), "/proc/self/root/%s", pm->mountpoint);
> > +	if (mount(buf, mnt_path, NULL, MS_BIND, NULL)) {
> > +		pr_perror("Can't bind-mount %d:%s to %s",
> > +				pm->mnt_id, pm->mountpoint, mnt_path);
> > +		rmdir(mnt_path);
> > +		goto out;
> > +	}
> > +
> > +	fd = open(mnt_path, O_RDONLY | O_DIRECTORY);
> > +	if (fd < 0)
> > +		pr_perror("Can't open %s\n", mnt_path);
> 
> Can we move this pr_perror into fd < 0 checking below?

No, because errno can be changed.

> 
> > +
> > +	if (umount2(mnt_path, MNT_DETACH)) {
> > +		pr_perror("Can't umount %s", mnt_path);
> > +		goto out;
> > +	}
> > +
> > +	if (rmdir(mnt_path)) {
> > +		pr_perror("Can't remove the directory %s", mnt_path);
> > +		goto out;
> > +	}
> > +
> > +	if (fd < 0)
> > +		goto out;
> > +


More information about the CRIU mailing list