Re: reading /dev/scd0 blocks sync(2) why ?

Gerard Roudier (groudier@club-internet.fr)
Sun, 12 Jan 1997 19:45:59 +0000 (GMT)


Harald,

On Sun, 12 Jan 1997, Harald Koenig wrote:

> when I'm reading data from a SCSI CDROM e.g. using
>
> dd if=/dev/scd0 bs=2k of=/dev/null
>
> the sync(2) system call is blocked until the "dd" command is terminated.
> why ? dd opens /dev/scd0 read-only; writing to a pipe gives the same
> problem so it's not writing to /dev/null...
>
> using Linux-2.0.27, Toshiba CDROM drive connected to an AHA1542B
> (only device on this SCSI bus; SCSI disks connected to NCR810).

In my opinion, this behavior is not driver related, but is probably due
to the fact that sys_sync() calls sync_buffer(wait=1) (see: fs/buffer.c).

On my system (CD/ROM + 2 HD on the same NCR875), "sync" does nor really
block. If there is lots of buffer to write, it may wait for dozen of
seconds.

For wait=1 and pass!=0 (3 passes), sync_buffer() waits for each locked
buffer and then restarts the scan of buffers. So, each time it encounters
a buffer locked for a CD/ROM read operation it may wait for severall
tenths of second (unnecessarily) ...

Gerard.