Re: [dm-devel] [PATCH]: create sysfs file, dh_state for SCSI devices even if they are not in the inteernal lists

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

 



Chandra Seetharaman wrote:
> Create the sysfs file, dh_state even if the new SCSI device is not
> in the any of the device handler's internal lists.
> 
> Signed-Off-by: Chandra Seetharaman <sekharan@xxxxxxxxxx>
> ---
>  drivers/scsi/device_handler/scsi_dh.c |   11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> Index: linux-2.6.31-rc1/drivers/scsi/device_handler/scsi_dh.c
> ===================================================================
> --- linux-2.6.31-rc1.orig/drivers/scsi/device_handler/scsi_dh.c
> +++ linux-2.6.31-rc1/drivers/scsi/device_handler/scsi_dh.c
> @@ -304,18 +304,15 @@ static int scsi_dh_notifier(struct notif
>  	sdev = to_scsi_device(dev);
>  
>  	if (action == BUS_NOTIFY_ADD_DEVICE) {
> +		err = device_create_file(dev, &scsi_dh_state_attr);
> +		/* don't care about err */
>  		devinfo = device_handler_match(NULL, sdev);
> -		if (!devinfo)
> -			goto out;
> -
> -		err = scsi_dh_handler_attach(sdev, devinfo);
> -		if (!err)
> -			err = device_create_file(dev, &scsi_dh_state_attr);
> +		if (devinfo)
> +			err = scsi_dh_handler_attach(sdev, devinfo);
>  	} else if (action == BUS_NOTIFY_DEL_DEVICE) {
>  		device_remove_file(dev, &scsi_dh_state_attr);
>  		scsi_dh_handler_detach(sdev, NULL);
>  	}
> -out:
>  	return err;
>  }
>  
> 
> 
> --
> dm-devel mailing list
> dm-devel@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/dm-devel
NACK.

This will create sysfs attributes even if the attach()
failed for other reason like a generic error. So we'll end
up with device handler attributes and no device handler attached.

Not a good idea.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@xxxxxxx			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, 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