lkml.org 
[lkml]   [2008]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: autosuspend for SCSI devices
Date
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


\
 
 \ /
  Last update: 2008-09-02 11:41    [W:0.060 / U:1.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site