geom nudge

Andriy Gapon avg at icyb.net.ua
Fri Jul 1 16:12:10 GMT 2005


I have SanDisk SDDR-75 usb dual card reader (CF and SM) detected by
FreeBSD as "SanDisk ImageMate CF-SM 0100". There is some minor
annoyance/oddity while using it that I would like to talk about. It
seems that the device needs a few seconds (up to 5) after plugging in to
settle in normal operating state. Apparently current code is not a good
friend of such "retarded" devices. umass->cam->geom detection sequence
does not seem to have sufficient delays and retries to wait for such a
long initialization. This is what I am getting in logs:

umass0: SanDisk Corporation ImageMate CF-SM, rev 1.10/1.00, addr 2
umass0:0:0:-1: Attached to scbus0
pass0 at umass-sim0 bus 0 target 0 lun 0
pass0: <SanDisk ImageMate CF-SM 0100> Removable Direct Access SCSI-0 device
pass0: Serial Number
pass0: 1.000MB/s transfers
GEOM: new disk da0
(da0:umass-sim0:0:0:0): error 6
(da0:umass-sim0:0:0:0): Unretryable Error
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <SanDisk ImageMate CF-SM 0100> Removable Direct Access SCSI-0 device
da0: Serial Number
da0: 1.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present
(da0:umass-sim0:0:0:0): READ CAPACITY. CDB: 25 0 0 0 0 0 0 0 0 0
(da0:umass-sim0:0:0:0): CAM Status: SCSI Status Error
(da0:umass-sim0:0:0:0): SCSI Status: Check Condition
(da0:umass-sim0:0:0:0): NOT READY asc:3a,0
(da0:umass-sim0:0:0:0): Medium not present
(da0:umass-sim0:0:0:0): (da0:umass-sim0:0:0:0): READ CAPACITY. CDB: 25 0
0 0 0 0 0 0 0 0
(da0:umass-sim0:0:0:0): NOT READY asc:3a,0
(da0:umass-sim0:0:0:0): Medium not present
Unretryable error
(da0:umass-sim0:0:0:0): error 6
(da0:umass-sim0:0:0:0): Unretryable Error
Opened disk da0 -> 6
(da0:umass-sim0:0:0:0): READ CAPACITY. CDB: 25 0 0 0 0 0 0 0 0 0
(da0:umass-sim0:0:0:0): CAM Status: SCSI Status Error
(da0:umass-sim0:0:0:0): SCSI Status: Check Condition
(da0:umass-sim0:0:0:0): NOT READY asc:3a,0
(da0:umass-sim0:0:0:0): Medium not present
(da0:umass-sim0:0:0:0): (da0:umass-sim0:0:0:0): READ CAPACITY. CDB: 25 0
0 0 0 0 0 0 0 0
(da0:umass-sim0:0:0:0): NOT READY asc:3a,0
(da0:umass-sim0:0:0:0): Medium not present
Unretryable error
(da0:umass-sim0:0:0:0): error 6
(da0:umass-sim0:0:0:0): Unretryable Error
Opened disk da0 -> 6

If I understand the messages and the code correctly, geom created a new
disk and tried to do subsequent magic stuff starting with querying
medium size, but that operation failed because of the said "retardness".
If I execute this command:
camcontrol cmd 2:0:0 -v -c "25 00 00 00 00 00 00 00 00 00" -i 8 "i4 i4"
in a loop with 1 second sleep, I see that READ CAPACITY fails for 3-5
seconds but then it works correctly.

I am actually OK with such situation. The problem is that the only
device created is obviously da0 i.e. there are no devices for slices
present on medium. So, when the card reader comes to senses I would like
to give a nudge to geom to "re-scan" or "re-create" da0. So far I have
failed to find a nice way to do it. camcontrol rescan and reset do not
help. The only thing that works is trying to mount /dev/da0, that
obviously fails but makes geom take a new look at the disk:

$ mount_msdosfs /dev/da0 /mnt/flash
mount_msdosfs: /dev/da0: Invalid argument
(note: mount ufs does it as well but with different error message)

$ ls -1 /dev/da*
/dev/da0
/dev/da0s1
/dev/da0s1s4

this is what I get in logs:

(da0:umass-sim0:0:0:0): READ CAPACITY. CDB: 25 0 0 0 0 0 0 0 0 0
(da0:umass-sim0:0:0:0): CAM Status: SCSI Status Error
(da0:umass-sim0:0:0:0): SCSI Status: Check Condition
(da0:umass-sim0:0:0:0): UNIT ATTENTION asc:28,0
(da0:umass-sim0:0:0:0): Not ready to ready change, medium may have changed
(da0:umass-sim0:0:0:0): (da0:umass-sim0:0:0:0): READ CAPACITY. CDB: 25 0
0 0 0 0 0 0 0 0
(da0:umass-sim0:0:0:0): UNIT ATTENTION asc:28,0
(da0:umass-sim0:0:0:0): Not ready to ready change, medium may have changed
Retrying Command (per Sense Data)
(da0:umass-sim0:0:0:0): Retrying Command
[0] f:80 typ:6 s(CHS):0/1/1 e(CHS):982/15/32 s:32 l:503264
[1] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
[2] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
[3] f:00 typ:0 s(CHS):0/0/0 e(CHS):0/0/0 s:0 l:0
GEOM: Configure da0s1, start 16384 length 257671168 end 257687551
[0] f:20 typ:32 s(CHS):356/97/46 e(CHS):357/116/40 s:1919950958 l:544437093
[1] f:61 typ:107 s(CHS):288/110/57 e(CHS):269/101/57 s:1330184202
l:538976288
[2] f:20 typ:83 s(CHS):345/32/19 e(CHS):324/77/19 s:538989391 l:1398362912
[3] f:80 typ:73 s(CHS):87/1/0 e(CHS):335/78/2 s:1394627663 l:21337
GEOM: Configure da0s1s4, start 714049363456 length 10924544 end 714060287999


As you can see, there is an oddity to this operation - what is the da0s1s4 ?
CF card has only one DOS filesystem and da0s1 works well, da0s1s4
produces error on any access attempt and its name is very weird.

Anyway, my main question is - is there any "nice" way to tell geom to
re-evaluate a disk ?
My secondary question is - is it possible to make geom(/cam?) try harder
to query disk than its current single-shot effort ?
My tertiary question is - WTF is da0s1s4 ? :-)

P.S. all information related to da1 (this is a dual card reader,
remember?) is ommited on purpose, as I use only CF slot.

-- 
Andriy Gapon


More information about the freebsd-stable mailing list