Maybe fsfreeze can avoid the race condition. (if this works with the involved FS) http://linux.die.net/man/8/fsfreeze https://github.com/karelzak/util-linux/blob/master/sys-utils/fsfreeze.c
Or just temporary remount source fs as ro. It might make some writing process unhappy but I'll keep file filesystem state. My two cents. Regards, Em seg, 7 de mar de 2016 às 10:10, John Crispin <blo...@openwrt.org> escreveu: > > > On 07/03/2016 14:03, Roman Yeryomin wrote: > > There is a race between `cp -a /tmp/root/* /rom/overlay` from > > libfstools/overlay.c and a process creating new file(s) before > > pivot(/rom, /mnt) occured. > > That is a process can create a file and it will not be copied. > > > > Currently I do additional copy after jffs2 is ready, which is kind of > > cumbersome (see attached patch), but there are still few potentially > > erroneous scenarios: > > 1. a process may recreate the file by the time second cp occurs > > 2. a process may delete a file (not existing at that moment) and > > second cp will copy it again > > 3. a process may want to read created file before second cp occurs > > > > If attached patch is the way to go I will properly submit it. > > Otherwise there should be a more fundamental fix but I don't see a way > > to fix this properly. > > > > > > Hi Roman > > that race has been there since the day we do overlayfs. i am always > surprised that it has not exploded in a big way yet. the only way i see > are workarounds such as yours or sending out lots of SIGSTOP and the > continues when we copied the files. either way it will be ugly and > require protective gear. > > i'll ponder this and see if we can find a better way > > John > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel > -- Luiz Angelo Daros de Luca luizl...@gmail.com
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel