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.
Regards,
Roman
--- a/libfstools/overlay.c
+++ b/libfstools/overlay.c
@@ -223,6 +223,9 @@ jffs2_switch(struct volume *v)
ULOG_INFO("performing overlay whiteout\n");
umount2("/tmp/root", MNT_DETACH);
foreachdir("/overlay/", handle_whiteout);
+ /* try hard to be in sync */
+ ULOG_INFO("syncronizing overlay\n");
+ system("cp -a /tmp/root/upper/* / 2>/dev/null");
}
break;
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel