OpenVZ Forum


Home » Mailing lists » Devel » [BUG][cryo] Create file on restart ?
[BUG][cryo] Create file on restart ? [message #31977] Wed, 16 July 2008 18:50 Go to previous message
Sukadev Bhattiprolu is currently offline  Sukadev Bhattiprolu
Messages: 413
Registered: August 2006
Senior Member
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);
	}
}
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [PATCH 0/4] - v2 - Object creation with a specified id
Next Topic: [RFC PATCH 0/5] Resend -v2 - Use procfs to change a syscall behavior
Goto Forum:
  


Current Time: Fri Oct 18 02:40:32 GMT 2024

Total time taken to generate the page: 0.05197 seconds