2

I'm hoping someone here can help me understand how Ubuntu 12.04.3 scans the SCSI bus periodically.

I've enabled SCSI logging via this command:

scsi_logging_level -E 3 -S 3 -M 2

When I plug in my BlackBerry 9800, I see the following set of messages periodically (charge mode, not UMASS mode):

[102356.446327] sd 32:0:0:1: Done: SUCCESS
[102356.446331] sd 32:0:0:1:  Result: hostbyte=DID_OK driverbyte=DRIVER_OK
[102356.446335] sd 32:0:0:1: CDB: Test Unit Ready: 00 20 00 00 00 00
[102356.446343] sd 32:0:0:1:  Sense Key : Not Ready [current] 
[102356.446347] sd 32:0:0:1:  Add. Sense: Medium not present
[102356.446358] sd 32:0:0:0: Send: 
[102356.446361] sd 32:0:0:0: CDB: Test Unit Ready: 00 00 00 00 00 00
[102356.447168] sd 32:0:0:0: Done: SUCCESS
[102356.447172] sd 32:0:0:0:  Result: hostbyte=DID_OK driverbyte=DRIVER_OK
[102356.447176] sd 32:0:0:0: CDB: Test Unit Ready: 00 00 00 00 00 00
[102356.447183] sd 32:0:0:0:  Sense Key : Not Ready [current] 
[102356.447188] sd 32:0:0:0:  Add. Sense: Medium not present

Finally, when I switch to UMASS mode, the medium is detected as present and the corresponding sd device nodes are created.

Everything is working as expected, but I would like to understand this functionality. So, what is triggering the periodic scan of the bus? Is there service somewhere which triggers this, or is this done directly by the kernel?

Update I

The messages are definitely coming from the kernel, so I believe that the kernel is responsible for the scanning of the SCSI devices. However, it's still not clear to me as to what is triggering the periodic rescan of my BlackBerry device.

1 Answer 1

2

Okay. I finally figured this out.

The polling is handled by the kernel directly. It does not happen in the SCSI layer as I originally thought, but it's handled at the block device layer. This was added several kernel versions ago, however it is disabled by default in kernel.org source.

You can change the default polling interval with the following command (you must be root):

echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs

or the sudo friendly version:

echo 2000 | sudo tee -a /sys/module/block/parameters/events_dfl_poll_msecs

I assume that during the Ubuntu init, this is set, or maybe they directly patch the kernel.org source with their own default value.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .