Re: [PATCH v12 3/6] Restrict device state changes allowed via sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/27/2013 04:54 PM, Bart Van Assche wrote:
> Restrict the SCSI device state changes allowd via sysfs to the
> OFFLINE<>RUNNING transitions. Other transitions may confuse
> the SCSI mid-layer. As an example, changing the state of a SCSI
> device via sysfs into "cancel" or "deleted" prevents removal of
> a SCSI device by scsi_remove_host().
> 
> Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
> Cc: Tejun Heo <tj@xxxxxxxxxx>
> Cc: James Bottomley <JBottomley@xxxxxxxxxxxxx>
> Cc: Mike Christie <michaelc@xxxxxxxxxxx>
> Cc: Hannes Reinecke <hare@xxxxxxx>
> Cc: David Milburn <dmilburn@xxxxxxxxxx>
> ---
>  drivers/scsi/scsi_sysfs.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index 931a7d9..013c6de 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -605,7 +605,7 @@ store_state_field(struct device *dev, struct device_attribute *attr,
>  			break;
>  		}
>  	}
> -	if (!state)
> +	if (state != SDEV_OFFLINE && state != SDEV_RUNNING)
>  		return -EINVAL;
>  
>  	if (scsi_device_set_state(sdev, state))
> 
Acked-by: Hannes Reinecke <hare@xxxxxxx>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@xxxxxxx			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux