[CRIU] [PATCH 1/4] sk-unix: Save mnt_id for bindmounted entries

Cyrill Gorcunov gorcunov at gmail.com
Thu Aug 10 10:00:16 MSK 2017


On Wed, Aug 09, 2017 at 04:37:51PM -0700, Andrei Vagin wrote:
...
> > +
> > +		if (switch_ns_by_fd(mntns_fd, &mnt_ns_desc, &old_ns)) {
> 
> can we use open_mountpoint() and statat? A path to a socket may be
> over-mounted.

I'm not sure if we're allowed to call it on "checkpoint" state, but
will figure out, thanks!

> > +
> > +			list_for_each_entry(sk, &unix_sockets, list) {
> > +				if (sk->uv.udiag_vfs_ino == (int)st.st_ino &&
> > +				    sk->uv.udiag_vfs_dev == (int)st.st_dev) {
> > +					pr_debug("Found sock s_dev %#x ino %#x bindmounted mnt_id %d %s\n",
> > +						 (int)st.st_dev, (int)st.st_ino, mi->mnt_id, mi->mountpoint);
> > +					sk->mnt_id = mi->mnt_id;
> 
> what if one socket will be mounted into two or more places?

Then its mnt_id will be the last matched, true it may cause problems.
Will rework thanks!

> 
> > +					if (sk->type != SOCK_DGRAM && sk->state != TCP_CLOSE) {
> > +						pr_err("Unsupported bindmounted socket ino %#x at %s\n",
> > +						       (int)st.st_ino, mi->mountpoint);
> > +						ret = -1;
> > +						break;
> > +					}
> 
> 					break;
> 
> > +				}
> > +			}
> > +		}
> > +
> > +		if (switch_ns_by_fd(old_ns, &mnt_ns_desc, NULL)) {
> 
> restore_ns

Thanks!


More information about the CRIU mailing list