Le quartidi 4 floréal, an CCXXIII, Vincent Lefevre a écrit : > David's test was to show what could happen in practice after some > simple change, such as removing objects from the directory, not to > take care of all possible race conditions
Simple changes are the bricks for race conditions. > (which is not possible, > except by checking them afterwards, e.g. by looking at the mtime of > the directory, though I'm not even sure that this is reliable). It is not, depending on your actual goal. > David's test shows that the renamed file is missed. No, it shows that the renamed file is NOT missed: he renamed the entry for inode 497003 from file2 into a long name, and that entry is returned, exactly once, under its old name. The "oops, file2 stat() fails" only shows the race condition between readdir() return and stat(); I am sure that if he printed dirent.d_ino instead of stat.st_ino, it would have printed 497003. > I agree, but this needs support from the filesystem itself. That would not be enough. Reliable backups require application support. Just think of all the Vim swap files or the temp file just before an atomic update. But that is another discussion. Regards, -- Nicolas George
signature.asc
Description: Digital signature