Linux Container Development
 help / color / mirror / Atom feed
From: sukadev-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org
To: Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: [BUG][cryo] Create file on restart ?
Date: Wed, 16 Jul 2008 11:50:27 -0700	[thread overview]
Message-ID: <20080716185027.GA1335@us.ibm.com> (raw)


cryo does not (cannot ?) recreate files if the application created
a file before checkpoint and the file does not exist at the time
of restart.

Note that the 'flags' field in '/proc/$pid/fdinfo/$fd' will not
have the O_CREAT (or O_TRUNC, O_EXCL, O_NOCTTY) flags. These
are cleared in __dentry_open()).

At the time of restart, is there a way for cryo to know that the
file must be created ?

To reproduce:
	- run following program, 
	- checkpoint after the first printf
	- rm /tmp/foo1
	- restart	# fails to open file during restart

---
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/fcntl.h>

main()
{
	int fd;
	int i;
	char *buf = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

	fd = open("/tmp/foo1", O_RDWR|O_CREAT|O_TRUNC, 0666);

	if (fd < 0) {
		perror("open");
		exit(1);
	}
	printf("%d: Opened '/tmp/foo1', fd %d\n", getpid(), fd);
	
	for (i = 0; i < strlen(buf); i++) {
		if (write(fd, &buf[i], 1) < 0) {
			printf("Error %d writing %c to file, i %d\n",
					errno, buf[i], i);
			exit(1);
		}
		printf("%d: i %d, wrote %c\n", getpid(), i, buf[i]);
		sleep(2);
	}
}

             reply	other threads:[~2008-07-16 18:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-16 18:50 sukadev-r/Jw6+rmf7HQT0dZR+AlfA [this message]
     [not found] ` <20080716185027.GA1335-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-07-16 19:26   ` [BUG][cryo] Create file on restart ? Serge E. Hallyn
     [not found]     ` <20080716192604.GA27454-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-07-16 20:45       ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]         ` <20080716204529.GA4278-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-07-16 20:57           ` Serge E. Hallyn
     [not found]             ` <20080716205737.GA2082-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-07-16 21:26               ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
     [not found]                 ` <20080716212609.GB4278-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-07-16 22:31                   ` Matt Helsley
     [not found]                     ` <1216247460.4844.177.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-07-16 23:20                       ` sukadev-r/Jw6+rmf7HQT0dZR+AlfA
2008-07-17  2:21                       ` Serge E. Hallyn
     [not found]                         ` <20080717022134.GB21726-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-07-17 23:35                           ` Oren Laadan
2008-07-17  2:18                   ` Serge E. Hallyn
2008-07-17 23:22                   ` Oren Laadan
2008-07-16 20:59       ` Matt Helsley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080716185027.GA1335@us.ibm.com \
    --to=sukadev-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox