[dm-devel] [multipath] SCSI device capacity mess

Patrick Mansfield patmans at us.ibm.com
Sat Oct 30 00:41:32 UTC 2004


On Thu, Oct 28, 2004 at 08:21:54PM +0200, Lars Marowsky-Bree wrote:
> On 2004-10-28T11:14:36, Patrick Mansfield <patmans at us.ibm.com> wrote:
> 
> > > Can't we do a test-unit-ready before trying to read and then just not
> > > read the partition table w/o so much noise?
> > We already issue a TUR in sd_spinup_disk() prior to the READ CAPACITY and
> > partition reads.
> 
> I'm just saying we should stop on the first failed command (TUR) and not
> retry to read all 64 sectors regardless. I can live with one error per
> passive path, but 64 really kills the logs.

That makes sense.

What is the result of the TUR? I did not see any information about it in other posts in this thread.

We should only send the READ CAPACTIY if the TUR says the device is
ready. Maybe the code in media_not_present() is wrong and causing a
problem.

This code in sd.c:

static int media_not_present(struct scsi_disk *sdkp, struct scsi_request *srp)
{
        if (!srp->sr_result)
                return 0;
        if (!(driver_byte(srp->sr_result) & DRIVER_SENSE))
                return 0;
        if (srp->sr_sense_buffer[2] != NOT_READY &&
            srp->sr_sense_buffer[2] != UNIT_ATTENTION)
                return 0;
        if (srp->sr_sense_buffer[12] != 0x3A) /* medium not present */
                return 0;

        set_media_not_present(sdkp);
        return 1;
}

For example if we got sr_result of a DID_NO_CONNECT or other error that
does not end up setting DRIVER_SENSE, driver_byte(sr_result) could be
0, and then we would return 0. 

Agree?

And then we allow a READ CAPACITY later on if media is present.

Maybe we have a similiar problem with the TUR to this device.

We should change state somehow if the TUR failed or was not ready, maybe
call set_media_not_present(), or maybe change the sdev state to
SDEV_OFFLINE - though that might cause extra logging.

We might not normally every hit this since the scan (INQUIRY failure)
would likely prevent the device from showing up at all. 

Plus, we only call sd_spinup_disk() during discovery and not on open,
unlike the calls to sd_media_changed().

-- Patrick Mansfield




More information about the dm-devel mailing list