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

Klaus Schmidinger Klaus.Schmidinger at cadsoft.de
Sat Feb 19 14:50:22 CET 2005


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



More information about the vdr mailing list