[CRIU] [PATCH 15/37] files: save mnt_id for reg files
Andrew Vagin
avagin at parallels.com
Fri Apr 18 11:45:27 PDT 2014
On Fri, Apr 18, 2014 at 07:30:04PM +0400, Pavel Emelyanov wrote:
> On 04/18/2014 06:42 PM, Andrey Vagin wrote:
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> > files-reg.c | 6 ++++++
> > protobuf/regfile.proto | 1 +
> > 2 files changed, 7 insertions(+)
> >
> > diff --git a/files-reg.c b/files-reg.c
> > index 5b6c4a3..3d316ec 100644
> > --- a/files-reg.c
> > +++ b/files-reg.c
> > @@ -22,6 +22,7 @@
> > #include "util.h"
> > #include "fs-magic.h"
> > #include "asm/atomic.h"
> > +#include "namespaces.h"
> >
> > #include "protobuf.h"
> > #include "protobuf/regfile.pb-c.h"
> > @@ -557,6 +558,11 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p)
> > } else
> > link = p->link;
> >
> > + if (p->mnt_id >= 0 && (root_ns_mask & CLONE_NEWNS)) {
> > + rfe.mnt_id = p->mnt_id;
> > + rfe.has_mnt_id = true;
> > + }
>
> I would also expect a check like this
>
> if (p->mnt_id < 0 && (root_ns_mask & CLONE_NEWNS)) {
> pr_err("Mount namespaces w/o mount ids\n");
> return -1;
> }
>
> Do we have such?
I think you don't want this, because it will break dumping and restoring
containers on 3.11.
>
>
> And also
>
> if (find_mount_by_id(p->mnt_id) == NULL) {
> pr_err("No mount for this file in this namespace\n");
> return -1;
> }
>
> How about this?
This looks reasonable. Thanks.
>
> > +
> > pr_info("Dumping path for %d fd via self %d [%s]\n",
> > p->fd, lfd, &link->name[1]);
> >
> > diff --git a/protobuf/regfile.proto b/protobuf/regfile.proto
> > index d975ab0..e91dc44 100644
> > --- a/protobuf/regfile.proto
> > +++ b/protobuf/regfile.proto
> > @@ -6,4 +6,5 @@ message reg_file_entry {
> > required uint64 pos = 3;
> > required fown_entry fown = 5;
> > required string name = 6;
> > + optional sint32 mnt_id = 7 [default = -1];
> > }
> >
>
>
More information about the CRIU
mailing list