All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Milburn <dmilburn@redhat.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: linux-scsi@vger.kernel.org, JBottomley@parallels.com
Subject: Re: [PATCH] scsi: remove device when state is changed to deleted thru sysfs
Date: Tue, 18 Dec 2012 08:57:23 -0600	[thread overview]
Message-ID: <50D08453.7030802@redhat.com> (raw)
In-Reply-To: <50D02095.2080505@acm.org>

Bart Van Assche wrote:
> On 12/18/12 00:26, David Milburn wrote:
>> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
>> index ce5224c..6d72abb 100644
>> --- a/drivers/scsi/scsi_sysfs.c
>> +++ b/drivers/scsi/scsi_sysfs.c
>> @@ -596,7 +596,7 @@ static ssize_t
>>   store_state_field(struct device *dev, struct device_attribute *attr,
>>             const char *buf, size_t count)
>>   {
>> -    int i;
>> +    int i, rc;
>>       struct scsi_device *sdev = to_scsi_device(dev);
>>       enum scsi_device_state state = 0;
>>
>> @@ -611,7 +611,11 @@ store_state_field(struct device *dev, struct 
>> device_attribute *attr,
>>       if (!state)
>>           return -EINVAL;
>>
>> -    if (scsi_device_set_state(sdev, state))
>> +    if (state == SDEV_DEL) {
>> +        rc = device_schedule_callback(dev, sdev_store_delete_callback);
>> +        if (rc)
>> +            count = rc;
>> +    } else if (scsi_device_set_state(sdev, state))
>>           return -EINVAL;
>>       return count;
>>   }
> 
> Hello David,
> 
> And what about the "cancel" state ? I guess this means that you have 
> missed patch http://marc.info/?l=linux-scsi&m=135480941801843 ?

Hi Bart,

Sorry, I did miss that patch.

Adding SDEV_CANCEL to the above check would result in __scsi_remove_device()
not completing since it wouldn't be able to set the device state from 
SDEV_CANCEL
to SDEV_CANCEL. Your patch to not allow this state change makes sense.

Thanks,
David



> 
> Bart.
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


      reply	other threads:[~2012-12-18 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17 23:26 [PATCH] scsi: remove device when state is changed to deleted thru sysfs David Milburn
2012-12-18  7:51 ` Bart Van Assche
2012-12-18 14:57   ` David Milburn [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=50D08453.7030802@redhat.com \
    --to=dmilburn@redhat.com \
    --cc=JBottomley@parallels.com \
    --cc=bvanassche@acm.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.