public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.de>
To: Pavel Machek <pavel@suse.cz>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	linux-pm@lists.linux-foundation.org,
	James.Bottomley@hansenpartnership.com,
	linux-kernel@vger.kernel.org, teheo@novell.com,
	stefanr@s5r6.in-berlin.de, Martin.Leisner@xerox.com
Subject: Re: autosuspend for SCSI devices
Date: Tue, 2 Sep 2008 11:39:15 +0200	[thread overview]
Message-ID: <200809021139.16624.oneukum@suse.de> (raw)
In-Reply-To: <20080902090800.GA25178@elf.ucw.cz>

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

  reply	other threads:[~2008-09-02  9:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-22 10:56 autosuspend for SCSI devices Pavel Machek
2008-08-22 20:52 ` Rafael J. Wysocki
2008-08-25  8:19   ` Pavel Machek
2008-08-25  8:55     ` Oliver Neukum
2008-08-26  9:43       ` Pavel Machek
2008-08-26 11:01         ` Oliver Neukum
2008-08-28  8:04           ` Pavel Machek
2008-08-28 21:17             ` Oliver Neukum
2008-09-02  9:08               ` Pavel Machek
2008-09-02  9:39                 ` Oliver Neukum [this message]
2008-09-02 14:04                 ` [linux-pm] " Alan Stern
2008-08-25 19:47 ` Tino Keitel
2008-08-26  9:44   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200809021139.16624.oneukum@suse.de \
    --to=oneukum@suse.de \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=Martin.Leisner@xerox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=pavel@suse.cz \
    --cc=rjw@sisk.pl \
    --cc=stefanr@s5r6.in-berlin.de \
    --cc=teheo@novell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox