[1/5] Process Migration using Sockets

Submitted by Rodrigo Bruno on Feb. 11, 2017, 3:34 a.m.

Details

Message ID 7bb62f1a94cbd342311579bf9a08e29c.squirrel@146.193.41.131
State New
Series "Series without cover letter"
Headers show

Commit Message

Rodrigo Bruno Feb. 11, 2017, 3:34 a.m.
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@gsd.inesc-id.pt>

Patch hide | download patch | download mbox

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 {

Comments

Pavel Emelianov Feb. 13, 2017, 12:54 p.m.
Applied, thanks.

Next time when sending patches, note, that the subject of the
e-mail should contain the patch summary, not the series summary.
Rodrigo Bruno Feb. 13, 2017, 8:11 p.m.
Hi,

noted!

Once the code is merged, I'm ready to help improving it.

rodrigo

2017-02-13 12:54 GMT+00:00 Pavel Emelyanov <xemul@virtuozzo.com>:

> Applied, thanks.
>
> Next time when sending patches, note, that the subject of the
> e-mail should contain the patch summary, not the series summary.
>
>