Thomas Schmitt 2020-07-31 11:05:18 +00:00
parent 95329092e8
commit 09e95577b8

@ -86,8 +86,26 @@ the translation from `/dev/sr` to `/dev/sg` is not guaranteed to work in future,
and `/dev/sr*` is better coordinated with `mount(8)` and `open(2)` for and `/dev/sr*` is better coordinated with `mount(8)` and `open(2)` for
`read(2)`. `read(2)`.
So long lasting SCSI transactions via `/dev/sr*` cause long If you are able to compile an own Linux kernel, then the remedy is quite
delays of communication with the other drives. Some of these delays simple. In the source code of kernel 4.19 i edited `drivers/scsi/sr.c`,
included `<scsi/sg.h>` which defines SG_IO, and skipped the mutex calls in
function `sr_block_ioctl()` in case of SG_IO:
```
static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
unsigned long arg)
{
...
if (cmd != SG_IO)
mutex_lock(&sr_mutex);
...
if (cmd != SG_IO)
mutex_unlock(&sr_mutex);
...
}
```
Without such a code change, long lasting SCSI transactions via `/dev/sr*`
cause long delays of communication with the other drives. Some of these delays
cannot be avoided. cannot be avoided.
E.g. the SCSI command to eject the tray needs several seconds to be E.g. the SCSI command to eject the tray needs several seconds to be
completed. completed.