ext4 and data loss
Posted Mar 12, 2009 1:45 UTC (Thu) by
jimparis (subscriber, #38647)
Parent article:
ext4 and data loss
I read the bug discussion but don't fully understand what's going on here.
Assume the code is
fd = open("file.new",O_TRUNC|O_WRONLY|O_CREAT);
write(fd, "hi", 2);
close(fd);
rename("file.new", "file");
Are we saying that in ext4, the rename can happen many tens-of-seconds before the data "hi" is actually allocated and written?
That's concerning. I'd expect that if I do that sequence of commands, the write would happen before the rename, and a crash would lead to:
(1) Nothing gets changed (ie. the old contents are still there),
if it's been less than 30 seconds
(2) The new contents are there, if the crash happens after 30 seconds.
Anything else might be POSIX-correct but that's going to break a lot of assumptions in existing code, I think.
Or am I misunderstanding things here?
(
Log in to post comments)