Re: autosuspend for SCSI devices
From: Oliver Neukum
Date: Tue Sep 02 2008 - 05:38:18 EST
Am Dienstag 02 September 2008 11:08:00 schrieb Pavel Machek:
Hello!
> > /**
> > * scsi_block_when_processing_errors - Prevent cmds from being queued.
> > * @sdev: Device on which we are performing recovery.
> > *
> > * Description:
> > * We block until the host is out of error recovery, and then check to
> > * see whether the host or the device is offline.
> > *
> > * Return value:
> > * 0 when dev was taken offline by error recovery. 1 OK to proceed.
> > */
> > int scsi_block_when_processing_errors(struct scsi_device *sdev)
>
>
> Hmm, scsi_block_when_ function, which does not _block_, and returns
/**
* scsi_block_when_processing_errors - Prevent cmds from being queued.
* @sdev: Device on which we are performing recovery.
*
* Description:
* We block until the host is out of error recovery, and then check to
* see whether the host or the device is offline.
*
* Return value:
* 0 when dev was taken offline by error recovery. 1 OK to proceed.
*/
int scsi_block_when_processing_errors(struct scsi_device *sdev)
{
int online;
wait_event(sdev->host->host_wait, !scsi_host_in_recovery(sdev->host));
This I would expect to block. But it may be unwise to block this long.
online = scsi_device_online(sdev);
SCSI_LOG_ERROR_RECOVERY(5, printk("%s: rtn: %d\n", __func__,
online));
return online;
}
> inverted values from what would people expect.
>
> ...but this should fix it, no? [incremental to previous]
> Pavel
>
> diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
> index 3c184fe..7e5ea0d 100644
> --- a/drivers/scsi/scsi_pm.c
> +++ b/drivers/scsi/scsi_pm.c
> @@ -10,6 +10,7 @@ #define DEBUG
> #include <scsi/scsi.h>
> #include <scsi/scsi_device.h>
> #include <scsi/scsi_host.h>
> +#include <scsi/scsi_eh.h>
>
> #include <linux/delay.h>
>
> @@ -128,8 +129,11 @@ static int autosuspend_check(struct scsi
> if (!(sdev->sdev_state == SDEV_RUNNING ||
> sdev->sdev_state == SDEV_QUIESCE))
> return -ENODEV;
> + if (!scsi_block_when_processing_errors(sdev))
> + return -EBUSY;
Why this? It seems to me for purpose of autosuspend an offlined device
should be totally ignored.
Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/