All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: create sysfs file, dh_state for SCSI devices even if they are not in the inteernal lists
@ 2009-06-27  2:31 Chandra Seetharaman
  2009-06-29  7:40 ` [dm-devel] " Hannes Reinecke
  2009-09-11 17:20 ` [RESEND] [PATCH]: scsi_dh: create sysfs file, dh_state for SCSI devices even if they are not in the internal lists Chandra Seetharaman
  0 siblings, 2 replies; 9+ messages in thread
From: Chandra Seetharaman @ 2009-06-27  2:31 UTC (permalink / raw)
  To: linux-scsi; +Cc: dm-devel, Mario Mech

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@us.ibm.com>
---
 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;
 }
 



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dm-devel] [PATCH]: create sysfs file, dh_state for SCSI devices even if they are not in the inteernal lists
  2009-06-27  2:31 [PATCH]: create sysfs file, dh_state for SCSI devices even if they are not in the inteernal lists Chandra Seetharaman
@ 2009-06-29  7:40 ` Hannes Reinecke
  2009-06-29 16:09   ` James Bottomley
  2009-06-29 19:30   ` Chandra Seetharaman
  2009-09-11 17:20 ` [RESEND] [PATCH]: scsi_dh: create sysfs file, dh_state for SCSI devices even if they are not in the internal lists Chandra Seetharaman
  1 sibling, 2 replies; 9+ messages in thread
From: Hannes Reinecke @ 2009-06-29  7:40 UTC (permalink / raw)
  To: sekharan, device-mapper development; +Cc: linux-scsi, Mario Mech

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@us.ibm.com>
> ---
>  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@redhat.com
> 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@suse.de			      +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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dm-devel] [PATCH]: create sysfs file, dh_state for SCSI devices even if they are not in the inteernal lists
  2009-06-29  7:40 ` [dm-devel] " Hannes Reinecke
@ 2009-06-29 16:09   ` James Bottomley
  2009-06-30  6:39     ` Hannes Reinecke
  2009-06-29 19:30   ` Chandra Seetharaman
  1 sibling, 1 reply; 9+ messages in thread
From: James Bottomley @ 2009-06-29 16:09 UTC (permalink / raw)
  To: device-mapper development; +Cc: sekharan, Mario Mech, linux-scsi

On Mon, 2009-06-29 at 09:40 +0200, Hannes Reinecke wrote:
> 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@us.ibm.com>
> > ---
> >  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@redhat.com
> > 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.

It strikes me that what is really being reinvented here is driver
attachment with driver attribute files ...

Now all of this could be avoided if we had multiple attachment of
drivers ... 

James



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH]: create sysfs file, dh_state for SCSI devices even if they are not in the inteernal lists
  2009-06-29  7:40 ` [dm-devel] " Hannes Reinecke
  2009-06-29 16:09   ` James Bottomley
@ 2009-06-29 19:30   ` Chandra Seetharaman
  2009-07-07 19:43     ` [dm-devel] " Chandra Seetharaman
  2009-08-03 19:51     ` Chandra Seetharaman
  1 sibling, 2 replies; 9+ messages in thread
From: Chandra Seetharaman @ 2009-06-29 19:30 UTC (permalink / raw)
  To: device-mapper development; +Cc: Mario Mech, linux-scsi


On Mon, 2009-06-29 at 09:40 +0200, Hannes Reinecke wrote:
> 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@us.ibm.com>
> > ---
> >  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@redhat.com
> > 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.

we do not have to worry about if attach failed or succeeded. We will
have "detached" if there is no device handler is attached to a device. 

Basically, existence of this file simply means that scsi_dh module is
active, only the contents of this file will indicate if any device
handler is attached or not.

We are just creating the file dh_state for each SCSI device that exists
and that is the only way non-in-built devices can be attached to a
handler by the end-user.

Do note that we do create this file for all the existing scsi devices
when the scsi_dh module is inserted (see scsi_dh_init()).

> 
> Not a good idea.

I do not agree, and we do need to have this fix for dh_state file to be
functionally useful.

> 
> Cheers,
> 
> Hannes

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dm-devel] [PATCH]: create sysfs file, dh_state for SCSI devices even if they are not in the inteernal lists
  2009-06-29 16:09   ` James Bottomley
@ 2009-06-30  6:39     ` Hannes Reinecke
  0 siblings, 0 replies; 9+ messages in thread
From: Hannes Reinecke @ 2009-06-30  6:39 UTC (permalink / raw)
  To: device-mapper development; +Cc: Mario Mech, linux-scsi, sekharan

James Bottomley wrote:
> On Mon, 2009-06-29 at 09:40 +0200, Hannes Reinecke wrote:
>> 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@us.ibm.com>
>>> ---
>>>  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;
>>>  }
>>>  
>>>
>>>
>> 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.
> 
> It strikes me that what is really being reinvented here is driver
> attachment with driver attribute files ...
> 
> Now all of this could be avoided if we had multiple attachment of
> drivers ... 
> 
I heard you.

If you find someone to fix the blasted iSCSI I/O stall for me ...

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)
--
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dm-devel] [PATCH]: create sysfs file, dh_state for SCSI devices even if they are not in the inteernal lists
  2009-06-29 19:30   ` Chandra Seetharaman
@ 2009-07-07 19:43     ` Chandra Seetharaman
  2009-08-03 19:51     ` Chandra Seetharaman
  1 sibling, 0 replies; 9+ messages in thread
From: Chandra Seetharaman @ 2009-07-07 19:43 UTC (permalink / raw)
  To: device-mapper development; +Cc: Mario Mech, linux-scsi

Hannes,

any comments ?

chandra
On Mon, 2009-06-29 at 12:30 -0700, Chandra Seetharaman wrote:
> On Mon, 2009-06-29 at 09:40 +0200, Hannes Reinecke wrote:
> > 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@us.ibm.com>
> > > ---
> > >  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@redhat.com
> > > 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.
> 
> we do not have to worry about if attach failed or succeeded. We will
> have "detached" if there is no device handler is attached to a device. 
> 
> Basically, existence of this file simply means that scsi_dh module is
> active, only the contents of this file will indicate if any device
> handler is attached or not.
> 
> We are just creating the file dh_state for each SCSI device that exists
> and that is the only way non-in-built devices can be attached to a
> handler by the end-user.
> 
> Do note that we do create this file for all the existing scsi devices
> when the scsi_dh module is inserted (see scsi_dh_init()).
> 
> > 
> > Not a good idea.
> 
> I do not agree, and we do need to have this fix for dh_state file to be
> functionally useful.
> 
> > 
> > Cheers,
> > 
> > Hannes


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dm-devel] [PATCH]: create sysfs file, dh_state for SCSI devices even if they are not in the inteernal lists
  2009-06-29 19:30   ` Chandra Seetharaman
  2009-07-07 19:43     ` [dm-devel] " Chandra Seetharaman
@ 2009-08-03 19:51     ` Chandra Seetharaman
  2009-08-11  8:54       ` Hannes Reinecke
  1 sibling, 1 reply; 9+ messages in thread
From: Chandra Seetharaman @ 2009-08-03 19:51 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: device-mapper development, Mario Mech, linux-scsi

Hi Hannes,

Can you comment on this please.

If you are convinced with my justification, please send an ACK.

Thanks & Regards,

chandra
On Mon, 2009-06-29 at 12:30 -0700, Chandra Seetharaman wrote:
> On Mon, 2009-06-29 at 09:40 +0200, Hannes Reinecke wrote:
> > 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@us.ibm.com>
> > > ---
> > >  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@redhat.com
> > > 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.
> 
> we do not have to worry about if attach failed or succeeded. We will
> have "detached" if there is no device handler is attached to a device. 
> 
> Basically, existence of this file simply means that scsi_dh module is
> active, only the contents of this file will indicate if any device
> handler is attached or not.
> 
> We are just creating the file dh_state for each SCSI device that exists
> and that is the only way non-in-built devices can be attached to a
> handler by the end-user.
> 
> Do note that we do create this file for all the existing scsi devices
> when the scsi_dh module is inserted (see scsi_dh_init()).
> 
> > 
> > Not a good idea.
> 
> I do not agree, and we do need to have this fix for dh_state file to be
> functionally useful.
> 
> > 
> > Cheers,
> > 
> > Hannes


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH]: create sysfs file, dh_state for SCSI devices even if they are not in the inteernal lists
  2009-08-03 19:51     ` Chandra Seetharaman
@ 2009-08-11  8:54       ` Hannes Reinecke
  0 siblings, 0 replies; 9+ messages in thread
From: Hannes Reinecke @ 2009-08-11  8:54 UTC (permalink / raw)
  To: sekharan; +Cc: Mario Mech, device-mapper development, linux-scsi

Chandra Seetharaman wrote:
> Hi Hannes,
> 
> Can you comment on this please.
> 
> If you are convinced with my justification, please send an ACK.
> 
> Thanks & Regards,
> 
> chandra
> On Mon, 2009-06-29 at 12:30 -0700, Chandra Seetharaman wrote:
>> On Mon, 2009-06-29 at 09:40 +0200, Hannes Reinecke wrote:
>>> 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@us.ibm.com>
>>>> ---
>>>>  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@redhat.com
>>>> 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.
>> we do not have to worry about if attach failed or succeeded. We will
>> have "detached" if there is no device handler is attached to a device. 
>>
>> Basically, existence of this file simply means that scsi_dh module is
>> active, only the contents of this file will indicate if any device
>> handler is attached or not.
>>
>> We are just creating the file dh_state for each SCSI device that exists
>> and that is the only way non-in-built devices can be attached to a
>> handler by the end-user.
>>
>> Do note that we do create this file for all the existing scsi devices
>> when the scsi_dh module is inserted (see scsi_dh_init()).
>>
Right. So you're changing the semantics from the 'dh_state' attribute
to mean 'scsi_dh' is active, not 'a scsi_dh module has been attached'.

Ok, that seems reasonable.

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

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)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [RESEND] [PATCH]: scsi_dh: create sysfs file, dh_state for SCSI devices even if they are not in the internal lists
  2009-06-27  2:31 [PATCH]: create sysfs file, dh_state for SCSI devices even if they are not in the inteernal lists Chandra Seetharaman
  2009-06-29  7:40 ` [dm-devel] " Hannes Reinecke
@ 2009-09-11 17:20 ` Chandra Seetharaman
  1 sibling, 0 replies; 9+ messages in thread
From: Chandra Seetharaman @ 2009-09-11 17:20 UTC (permalink / raw)
  To: James Bottomley; +Cc: Mario Mech, dm-devel, linux-scsi


Hi James,

This patch was sent to the list long back and was Acked by Hannes on Aug
11.

Please consider for inclusion. Let me know if you see any issues with
the patch.

regards,

chandra
-------------------------
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@us.ibm.com>
Acked-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/device_handler/scsi_dh.c |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Index: linux-2.6.31/drivers/scsi/device_handler/scsi_dh.c
===================================================================
--- linux-2.6.31.orig/drivers/scsi/device_handler/scsi_dh.c
+++ linux-2.6.31/drivers/scsi/device_handler/scsi_dh.c
@@ -292,18 +292,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;
 }
 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-09-11 17:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-27  2:31 [PATCH]: create sysfs file, dh_state for SCSI devices even if they are not in the inteernal lists Chandra Seetharaman
2009-06-29  7:40 ` [dm-devel] " Hannes Reinecke
2009-06-29 16:09   ` James Bottomley
2009-06-30  6:39     ` Hannes Reinecke
2009-06-29 19:30   ` Chandra Seetharaman
2009-07-07 19:43     ` [dm-devel] " Chandra Seetharaman
2009-08-03 19:51     ` Chandra Seetharaman
2009-08-11  8:54       ` Hannes Reinecke
2009-09-11 17:20 ` [RESEND] [PATCH]: scsi_dh: create sysfs file, dh_state for SCSI devices even if they are not in the internal lists Chandra Seetharaman

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.