overlay: fix race condition when switching to jffs2
authorRoman Yeryomin <roman@advem.lv>
Fri, 15 Dec 2017 14:10:30 +0000 (16:10 +0200)
committerJohn Crispin <john@phrozen.org>
Tue, 2 Jan 2018 06:54:17 +0000 (07:54 +0100)
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.

To workaround this, do additional copy after jffs2 is ready.
This doesn't completely solve the problem but since there
was no other fix provided since original RFC [1], it is better
than nothiing.

[1] https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg38218.html

Signed-off-by: Roman Yeryomin <roman@advem.lv>

No differences found