[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.0809020957320.2489-100000@iolanthe.rowland.org>
Date: Tue, 2 Sep 2008 10:04:02 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Pavel Machek <pavel@...e.cz>
cc: Oliver Neukum <oneukum@...e.de>,
<James.Bottomley@...senpartnership.com>,
<linux-kernel@...r.kernel.org>, <teheo@...ell.com>,
<stefanr@...6.in-berlin.de>, <Martin.Leisner@...ox.com>,
<linux-pm@...ts.linux-foundation.org>
Subject: Re: [linux-pm] autosuspend for SCSI devices
On Tue, 2 Sep 2008, Pavel Machek wrote:
> > > > You'd make scsi driver writers' life easier if you made sure no autosuspends
> > > > happen while they recover from errors. After all, you have no idea which
> > > > commands will get through while the bus is in disarray.
> > >
> > > Well, they have to handle other commands while bus has problems,
> > > anyway, right? So I'm not creating any _new_ problems for them.
> > >
> > > Pavel
> >
> >
> > I am afraid this is not true.
>
> I guess you are right.
> ...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;
>
> suspend_time = sdev->last_busy + sdev->autosuspend_delay;
> + /* FIXME: what if suspend_time - jiffies == -EPERM by some strange chance */
> if (time_before(jiffies, suspend_time))
> return suspend_time - jiffies;
> return 0;
If I'm not mistaken, while error hanlding is in progress we always have
shost->shost_state equal to either SHOST_RECOVERY or
SHOST_CANCEL_RECOVERY. This is a better test to use.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists