linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] Check for deleted device in scsi_device_online()
Date: Mon, 12 Jan 2009 09:28:55 +0100	[thread overview]
Message-ID: <496AFF47.3010100@suse.de> (raw)
In-Reply-To: <1231432056.3237.25.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1286 bytes --]

Hi James,

James Bottomley wrote:
> On Tue, 2008-12-16 at 16:33 +0100, Hannes Reinecke wrote:
>> scsi_device_online() is not just a negation of SDEV_OFFLINE,
>> also devices in state SDEV_CANCEL and SDEV_DEL are
>> actually offline.
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.de>
>> ---
>>  include/scsi/scsi_device.h |    4 +++-
>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
>> index e96daf6..63b58d2 100644
>> --- a/include/scsi/scsi_device.h
>> +++ b/include/scsi/scsi_device.h
>> @@ -401,7 +401,9 @@ static inline unsigned int sdev_id(struct scsi_device *sdev)
>>   */
>>  static inline int scsi_device_online(struct scsi_device *sdev)
>>  {
>> -	return sdev->sdev_state != SDEV_OFFLINE;
>> +	return (sdev->sdev_state != SDEV_OFFLINE &&
>> +		sdev->sdev_state != SDEV_CANCEL &&
>> +		sdev->sdev_state != SDEV_DEL);
> 
> SDEV_DEL is OK.  We can't do this for SDEV_CANCEL because that will
> block post removal commands (notably cache flush).
> 
You are correct as usual. Updated patch attached.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)

[-- Attachment #2: scsi-check-for-deleted-device-in-scsi_device_online --]
[-- Type: text/plain, Size: 674 bytes --]

scsi_device_online() is not just a negation of SDEV_OFFLINE,
also devices in state SDEV_DEL are actually offline.

Signed-off-by: Hannes Reinecke <hare@suse.de>

diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index e96daf6..bb80937 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -401,7 +401,8 @@ static inline unsigned int sdev_id(struct scsi_device *sdev)
  */
 static inline int scsi_device_online(struct scsi_device *sdev)
 {
-	return sdev->sdev_state != SDEV_OFFLINE;
+	return (sdev->sdev_state != SDEV_OFFLINE &&
+		sdev->sdev_state != SDEV_DEL);
 }
 static inline int scsi_device_blocked(struct scsi_device *sdev)
 {

      reply	other threads:[~2009-01-12  8:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-16 15:33 [PATCH] Check for deleted device in scsi_device_online() Hannes Reinecke
2009-01-08 16:27 ` James Bottomley
2009-01-12  8:28   ` Hannes Reinecke [this message]

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=496AFF47.3010100@suse.de \
    --to=hare@suse.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).