umount and data is lost?

umount and data is lost?

Shlomi Fish shlomif at shlomifish.org
Sun Nov 6 09:31:27 IST 2011


Hi Diego,

On Sat, 05 Nov 2011 23:12:59 +0200
Diego <elcuco at kde.org> wrote:

> 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() 

Just to check - did you use fflush() or fclose() after you wrote it?

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
"Humanity" - Parody of Modern Life - http://shlom.in/humanity

95% of Programmers consider 95% of the code they did not write, in the bottom
5%.

Please reply to list if it's a mailing list post - http://shlom.in/reply .



More information about the Linux-il mailing list