[CRIU] [PATCH v3 01/11] mount: save fs root fd of ps tree root mnt ns in its ns_id
Andrei Vagin
avagin at virtuozzo.com
Wed Aug 24 16:10:14 PDT 2016
On Tue, Aug 23, 2016 at 03:05:59PM +0300, Pavel Emelyanov wrote:
> Cc Andrey.
>
> This correlates with your patches that rework opening procedure.
In my patches, roots for all namespaces are opened too.
BTW: Why do you not commit my patches?
>
> On 08/10/2016 10:12 PM, Eugene Batalov wrote:
> > New criu gc command needs to access files in every ps tree ns.
> > It will use ns_id.mnt.root_fd for this.
> > ps tree processes shouldn't be created during criu gc so we can't
> > use /proc/$ns_pid/root based schema used in criu restore command.
> >
> > Signed-off-by: Eugene Batalov <eabatalov89 at gmail.com>
> > ---
> > criu/mount.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/criu/mount.c b/criu/mount.c
> > index 0f81681..7bbd30b 100644
> > --- a/criu/mount.c
> > +++ b/criu/mount.c
> > @@ -3160,8 +3160,7 @@ void fini_restore_mntns(void)
> > if (nsid->nd != &mnt_ns_desc)
> > continue;
> > close_safe(&nsid->mnt.ns_fd);
> > - if (nsid->type != NS_ROOT)
> > - close_safe(&nsid->mnt.root_fd);
> > + close_safe(&nsid->mnt.root_fd);
> > nsid->ns_populated = true;
> > }
> > }
> > @@ -3495,6 +3494,10 @@ ns_created:
> > nsid->mnt.ns_fd = open_proc(PROC_SELF, "ns/mnt");
> > if (nsid->mnt.ns_fd < 0)
> > goto err;
> > + /* root_fd is used to restore file mappings */
> > + nsid->mnt.root_fd = open_proc(PROC_SELF, "root");
> > + if (nsid->mnt.root_fd < 0)
> > + goto err;
> > /* we set ns_populated so we don't need to open root_fd */
> > nsid->ns_populated = true;
> > continue;
> >
>
More information about the CRIU
mailing list