umount and data is lost?

umount and data is lost?

Diego elcuco at kde.org
Sat Nov 5 23:12:59 IST 2011


Hi list, 

I am trying to debug this problem in a system I am developing: 

at some point I need to write a number to a file, and then reboot via an 
external device the machine. That device will cut of the power for a moment, 
and the machine will power on again (this is to overcome a fault we could not 
overcome otherwise). Before the reboot, I "umount" the proper partition and 
then "sync".

For some reason, on one machine we see that the data is not updated and the 
original data is kept in the file. I konw empirically that if I add a 
"sleep(5)" after the umount, and before the "reboot" the data is written to 
the disk.

Any tips how to debug this?
 * the system is a TI 2.6.32 kernel (OMAP)
 * the data is saved using fopen() 
 * disk is umounted using system("umount /data"), and then I call from C to 
sync();
  * Cannot print debug this easily since the reboot is automated at the start 
of the APP, and then busybox's "login" breaks my serial terminal (like this 
eats "\n", git fixes if I press enter)
 * The application is also multi-threaded to add more difficulty ...
 * FS is JFFS2
 * again  the workaround is a "sleep(5)"

Any ideas?




More information about the Linux-il mailing list