Hang on tools.c SpinUpDisk - system("sync")

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris Warren wrote:
>>I've looked into where the hang happens and its in SpinUpDisk on the 
>>line that calls system("sync") - if I comment this line out then 
>>everything works perfectly!
> 
> 
> I worked out what was happening - system(const char *string) uses /bin/sh
> which in my case is bash - bash is linked to the NTPL version of glibc. I
> wrote a small test which showed that executing something which uses NTPL
> threads from an application which uses linuxthreads never returns.
> 
> If the caller doesn't use threading the problem doesn't seem to occur.
> 
> So I've replaced system("sync") with an fsync(f) before the file descriptor
> is closed. The disk spins up fine now.

Looks good - especially since it gets rid of the last 'system()' call in VDR.

I guess I'll use fdatasync(), though, which according to the manual
should try even harder to make sure everything is in sync.

Klaus


[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux