[lkml]   [2006]   [Jun]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [linux-usb-devel] USB/hal: USB open() broken? (USB CD burner underruns, USB HDD hard resets)
    On Wed, 21 Jun 2006, Andreas Mohr wrote:

    > > It's not a USB issue; it's a matter of lack of coordination between the sg
    > > and sr drivers. Each is unaware of the actions of the other, even when
    > > they are speaking to the same device.
    > Right, I could have expressed it much better before, sorry.
    > Found the relevant code:
    > sd.c sd_open()
    > if (!sdkp->openers++ && sdev->removable) {
    > if (scsi_block_when_processing_errors(sdev))
    > scsi_set_medium_removal(sdev, SCSI_REMOVAL_PREVENT);
    > }

    Um, this isn't the relevant code. You're interested in sr.c, not sd.c.
    Furthermore, the actual ALLOW MEDIUM REMOVAL command is caused by code in
    drivers/cdrom/cdrom.c:cdrom_release(). This needs to be coordinated (the
    cdi->use_count variable) with the sg driver.

    > And the obvious question would be whether the sdkp->openers++ thingy
    > could somehow be extended to enclose all hardware device users so that
    > e.g. sr.c wouldn't send ALLOW_MEDIUM_REMOVAL on a device already locked
    > by e.g. the sd.c driver.
    > Difficult question, though, since the group of drivers possible to use
    > with a certain device is not a static set:
    > it could be via
    > - sr.c
    > - sd.c
    > - IDE (in the case of ATA devices mapped via ide-scsi)
    > - ???
    > Is it possible to have such a per-*hardware*-device instance in the kernel
    > to keep track of various things such as number of device openers?
    > I'll do some investigation myself, too...

    Look at include/scsi/scsi_device.h. There's plenty of opportunity for
    adding an additional counter.

    Alan Stern

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2006-06-21 22:00    [W:0.046 / U:0.084 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site