[CRIU] [PATCH 1/5] Process Migration using Sockets
rbruno at gsd.inesc-id.pt
rbruno at gsd.inesc-id.pt
Fri Feb 10 19:34:39 PST 2017
criu/image-desc.c | 4 ++--
criu/image.c | 4 ++--
criu/include/image.h | 1 +
3 files changed, 5 insertions(+), 4 deletions(-)
In order to prepare for remote snapshots (possible with Image Proxy
and Image
Cache) the O_FORCE_LOCAL flag is added to force some images not to be
remote
and stay as local files in the file system.
Signed-off-by: Rodrigo Bruno <rbruno at gsd.inesc-id.pt>
diff --git a/criu/image-desc.c b/criu/image-desc.c
index bac7ca2..fffaf5a 100644
--- a/criu/image-desc.c
+++ b/criu/image-desc.c
@@ -103,13 +103,13 @@ struct cr_fd_desc_tmpl imgset_template[CR_FD_MAX] = {
[CR_FD_STATS] = {
.fmt = "stats-%s",
.magic = STATS_MAGIC,
- .oflags = O_SERVICE,
+ .oflags = O_SERVICE | O_FORCE_LOCAL,
},
[CR_FD_IRMAP_CACHE] = {
.fmt = "irmap-cache",
.magic = IRMAP_CACHE_MAGIC,
- .oflags = O_SERVICE,
+ .oflags = O_SERVICE | O_FORCE_LOCAL,
},
[CR_FD_FILE_LOCKS_PID] = {
diff --git a/criu/image.c b/criu/image.c
index 11f1e7b..0ad6b89 100644
--- a/criu/image.c
+++ b/criu/image.c
@@ -316,11 +316,11 @@ static int do_open_image(struct cr_img *img, int
dfd, int type, unsigned long of
{
int ret, flags;
- flags = oflags & ~(O_NOBUF | O_SERVICE);
+ flags = oflags & ~(O_NOBUF | O_SERVICE | O_FORCE_LOCAL);
ret = openat(dfd, path, flags, CR_FD_PERM);
if (ret < 0) {
- if (!(flags & O_CREAT) && (errno == ENOENT)) {
+ if (!(flags & O_CREAT) && (errno == ENOENT || ret == -ENOENT)) {
pr_info("No %s image\n", path);
img->_x.fd = EMPTY_IMG_FD;
goto skip_magic;
diff --git a/criu/include/image.h b/criu/include/image.h
index 1c22a4f..c2b612e 100644
--- a/criu/include/image.h
+++ b/criu/include/image.h
@@ -105,6 +105,7 @@ extern bool img_common_magic;
#define O_DUMP (O_WRONLY | O_CREAT | O_TRUNC)
#define O_SHOW (O_RDONLY | O_NOBUF)
#define O_RSTR (O_RDONLY)
+#define O_FORCE_LOCAL (O_SYNC)
struct cr_img {
union {
More information about the CRIU
mailing list