Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Device-mapper Development (http://www.linux-archive.org/device-mapper-development/)
-   -   scsi_dh: Allow NULL hardware handler name in scsi_dh_attach() (http://www.linux-archive.org/device-mapper-development/651851-scsi_dh-allow-null-hardware-handler-name-scsi_dh_attach.html)

Mike Snitzer 04-02-2012 05:06 PM

scsi_dh: Allow NULL hardware handler name in scsi_dh_attach()
 
On Mon, Apr 02 2012 at 12:43pm -0400,
Hannes Reinecke <hare@suse.de> wrote:

> This patch allows to pass in a NULL hardware handler to
> scsi_dh_attach(), causing the reference count of the existing
> hardware handler to be increased.
> An error will be returned if no hardware handler is attached.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> drivers/scsi/device_handler/scsi_dh.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/device_handler/scsi_dh.c b/drivers/scsi/device_handler/scsi_dh.c
> index 48e46f5..77fa67e 100644
> --- a/drivers/scsi/device_handler/scsi_dh.c
> +++ b/drivers/scsi/device_handler/scsi_dh.c
> @@ -475,10 +475,14 @@ int scsi_dh_attach(struct request_queue *q, const char *name)
> {
> unsigned long flags;
> struct scsi_device *sdev;
> - struct scsi_device_handler *scsi_dh;
> + struct scsi_device_handler *scsi_dh = NULL;
> int err = 0;
>
> - scsi_dh = get_device_handler(name);
> + if (name) {
> + scsi_dh = get_device_handler(name);
> + } else if (sdev->scsi_dh_data) {
> + scsi_dh = sdev->scsi_dh_data->scsi_dh;
> + }

Extra brackets aren't needed. But otherwise:

Acked-by: Mike Snitzer <snitzer@redhat.com>

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

"Jun'ichi Nomura" 04-03-2012 01:46 AM

scsi_dh: Allow NULL hardware handler name in scsi_dh_attach()
 
Hi Hannes,

On 04/03/12 01:43, Hannes Reinecke wrote:
> This patch allows to pass in a NULL hardware handler to
> scsi_dh_attach(), causing the reference count of the existing
> hardware handler to be increased.
> An error will be returned if no hardware handler is attached.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> drivers/scsi/device_handler/scsi_dh.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/device_handler/scsi_dh.c b/drivers/scsi/device_handler/scsi_dh.c
> index 48e46f5..77fa67e 100644
> --- a/drivers/scsi/device_handler/scsi_dh.c
> +++ b/drivers/scsi/device_handler/scsi_dh.c
> @@ -475,10 +475,14 @@ int scsi_dh_attach(struct request_queue *q, const char *name)
> {
> unsigned long flags;
> struct scsi_device *sdev;
> - struct scsi_device_handler *scsi_dh;
> + struct scsi_device_handler *scsi_dh = NULL;
> int err = 0;
>
> - scsi_dh = get_device_handler(name);
> + if (name) {
> + scsi_dh = get_device_handler(name);
> + } else if (sdev->scsi_dh_data) {
> + scsi_dh = sdev->scsi_dh_data->scsi_dh;
> + }
> if (!scsi_dh)
> return -EINVAL;

It won't work. sdev is not initialized...

Thanks,
--
Jun'ichi Nomura, NEC Corporation

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Mike Snitzer 05-08-2012 02:27 PM

scsi_dh: Allow NULL hardware handler name in scsi_dh_attach()
 
On Tue, May 08 2012 at 10:18am -0400,
Hannes Reinecke <hare@suse.de> wrote:

> This patch allows to pass in a NULL hardware handler to
> scsi_dh_attach(), causing the reference count of the existing
> hardware handler to be increased.
> An error will be returned if no hardware handler is attached.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> drivers/scsi/device_handler/scsi_dh.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/device_handler/scsi_dh.c b/drivers/scsi/device_handler/scsi_dh.c
> index 48e46f5..9820f1f 100644
> --- a/drivers/scsi/device_handler/scsi_dh.c
> +++ b/drivers/scsi/device_handler/scsi_dh.c
> @@ -475,10 +475,14 @@ int scsi_dh_attach(struct request_queue *q, const char *name)
> {
> unsigned long flags;
> struct scsi_device *sdev;
> - struct scsi_device_handler *scsi_dh;
> + struct scsi_device_handler *scsi_dh = NULL;
> int err = 0;
>
> - scsi_dh = get_device_handler(name);
> + if (name) {
> + scsi_dh = get_device_handler(name);
> + } else if (sdev && sdev->scsi_dh_data) {
> + scsi_dh = sdev->scsi_dh_data->scsi_dh;
> + }

Like the first time you posted this, sdev is not initialized where
you're trying to use it (the sdev initialization happens later in
scsi_dh_attach). And you have extraneous curly braces.

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


All times are GMT. The time now is 07:38 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.