[CRIU] [PATCH 06/19] unix: Collect bindmounted unix sockets

Cyrill Gorcunov gorcunov at gmail.com
Wed Sep 19 12:10:01 MSK 2018


On Tue, Sep 18, 2018 at 04:59:02PM -0700, Andrey Vagin wrote:
> > +
> > +		if (switch_ns(mi->nsid->ns_pid, &mnt_ns_desc, &ns_old) < 0) {
> > +			pr_err("Can't switch ns to mnt_id %d", mi->mnt_id);
> > +			if (restore_ns(ns_old, &mnt_ns_desc)) {
> > +				pr_err("Can't switch mount ns back from mnt_id %d\n", mi->mnt_id);
> > +				return -1;
> > +			}
> 
> I think we can move this restore_ns to the end under the err label.

Will update

> > +			return -1;
> > +		}
> > +
> > +		if (stat(mi->mountpoint, &st)) {
> 
> can we use fstatat(mi->nsid->mnt.root, mi->mountpoint) here?

Nope.

(00.031787) unix: Collecting unix bindmounts
(00.031819) Warn  (criu/sk-unix.c:949): unix: Can't stat on ./zdtm/static/bind-mount-unix.test/criu-bind-log: Not a directory
(00.031845) Warn  (criu/sk-unix.c:949): unix: Can't stat on ./zdtm/static/bind-mount-unix.test: Not a directory

> ...
> 
> > +				if (sk->vfs_ino == (int)st.st_ino &&
> > +				    sk->vfs_dev == (int)st.st_dev) {
> > +					pr_debug("Found sock s_dev %#x ino %d bindmounted mnt_id %d %s\n",
> > +						 (int)st.st_dev, (int)st.st_ino, mi->mnt_id, mi->mountpoint);
> 
i> too many indents

ok, will rework

> > +		if (restore_ns(ns_old, &mnt_ns_desc)) {
> 
> restore_ns() should be called only once before exiting from this func

ok

	Cyrill


More information about the CRIU mailing list