linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Manual udev invocation & via hotplug method gives different results
@ 2004-03-12  1:26 Sabharwal, Atul
  2004-03-12  1:42 ` Greg KH
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Sabharwal, Atul @ 2004-03-12  1:26 UTC (permalink / raw)
  To: linux-hotplug

Is there a difference between invoking udev manually from the command
line versus
invoking it from a hotplug event ? I expect the same result but have a
case where
the results are different :

Manual Execution:
~~~~~~~~~~~~~~~~
There is just one rule in rules file and I set DEVPATH=/block/sdd,
ACTION ­d

BUS="scsi", PROGRAM="/usr/local/bin/chassis_id",
NAME="/chasis$%c{1}/slot%c{2]/%c{3}

When Action = add, it creates /chassis1/slot4/disk4 and when
Action=remove, it 
Deletes it. 

Simulating Hotplug event using scsi command:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The disk sdd is at SCSI address 2:0:1:0. To simulate insertion, type as
below ::

Echo "scsi add-single-device-method 2 0 1 0 " > /proc/scsi/scsi

I expect name entry of /chassis/slot4/disk4 but it creates three device
entries 
( sdd, sdd1 & sg3 ).

When I do a echo "scsi remove-single-device-method 2 0 1 0">
/proc/scsi/scsi, all three entries
Get deleted.

In case, the callout was returning a failure, I can understand udev
doing some default
Behavior but only sdd should have been created. Sdd1 is a partition and
sg3 is a character
Device. Am I getting multiple hotplug events ?? 

If anyone knew some similar situation or knows how to debug this problem
?

--
Atul




 





-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&opÌk
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: Manual udev invocation & via hotplug method gives different results
  2004-03-12  1:26 Manual udev invocation & via hotplug method gives different results Sabharwal, Atul
@ 2004-03-12  1:42 ` Greg KH
  2004-03-12  1:51 ` Sabharwal, Atul
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2004-03-12  1:42 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Mar 11, 2004 at 05:26:29PM -0800, Sabharwal, Atul wrote:
> Is there a difference between invoking udev manually from the command
> line versus
> invoking it from a hotplug event ? I expect the same result but have a
> case where
> the results are different :

Have you tried using udevtest to see if that gives you the same result?

I am not sure what the /proc/scsi... echoing really does with regards to
creating hotplug events.  Are you sure it is identical?

thanks,

greg k-h


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* RE: Manual udev invocation & via hotplug method gives different results
  2004-03-12  1:26 Manual udev invocation & via hotplug method gives different results Sabharwal, Atul
  2004-03-12  1:42 ` Greg KH
@ 2004-03-12  1:51 ` Sabharwal, Atul
  2004-03-12 18:44 ` Sabharwal, Atul
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sabharwal, Atul @ 2004-03-12  1:51 UTC (permalink / raw)
  To: linux-hotplug



> Is there a difference between invoking udev manually from the command
> line versus
> invoking it from a hotplug event ? I expect the same result but have a
> case where
> the results are different :

>>Have you tried using udevtest to see if that gives you the same
result?

How should I use udevtest ? Should I put it in place of udev binary ?

>>I am not sure what the /proc/scsi... echoing really does with regards
to
>>creating hotplug events.  Are you sure it is identical?

I think it's a software method for simulating SCSI/fiber channel disk 
insertion/deletion. It removes the device from /proc/scsi/scsi table.
It also deletes the device entry from sysfs. Which causes udev to
trigger.
In 2.6.2, the insertion/removal was not 100% reliable as command would
Fail or ignore user request. Now, with 2.6.4 kernel, the command is
Reliable but I get three new entries when I expect one!!

--
Atul





-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&opÌk
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* RE: Manual udev invocation & via hotplug method gives different results
  2004-03-12  1:26 Manual udev invocation & via hotplug method gives different results Sabharwal, Atul
  2004-03-12  1:42 ` Greg KH
  2004-03-12  1:51 ` Sabharwal, Atul
@ 2004-03-12 18:44 ` Sabharwal, Atul
  2004-03-12 18:54 ` Manual udev invocation & via hotplug method gives different Kay Sievers
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Sabharwal, Atul @ 2004-03-12 18:44 UTC (permalink / raw)
  To: linux-hotplug

>>Have you tried using udevtest to see if that gives you the same
result?

I tried udevtest and it gives same result as udev. The scsi
commands give three device entries. 

--
Atul





-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=ick
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&opÌk
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* RE: Manual udev invocation & via hotplug method gives different
  2004-03-12  1:26 Manual udev invocation & via hotplug method gives different results Sabharwal, Atul
                   ` (2 preceding siblings ...)
  2004-03-12 18:44 ` Sabharwal, Atul
@ 2004-03-12 18:54 ` Kay Sievers
  2004-03-12 19:03 ` Manual udev invocation & via hotplug method gives different results Patrick Mansfield
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Kay Sievers @ 2004-03-12 18:54 UTC (permalink / raw)
  To: linux-hotplug

On Fri, 2004-03-12 at 19:44, Sabharwal, Atul wrote:
> >>Have you tried using udevtest to see if that gives you the same
> result?
> 
> I tried udevtest and it gives same result as udev. The scsi
> commands give three device entries. 

Seems that the kernel emits 3 hotplug events for this device.
If you compile udev with 'make DEBUG=true' you can follow the invocation
of udevsend in the syslog.

Kay



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: Manual udev invocation & via hotplug method gives different results
  2004-03-12  1:26 Manual udev invocation & via hotplug method gives different results Sabharwal, Atul
                   ` (3 preceding siblings ...)
  2004-03-12 18:54 ` Manual udev invocation & via hotplug method gives different Kay Sievers
@ 2004-03-12 19:03 ` Patrick Mansfield
  2004-03-12 19:43 ` Sabharwal, Atul
  2004-03-12 23:50 ` Sabharwal, Atul
  6 siblings, 0 replies; 8+ messages in thread
From: Patrick Mansfield @ 2004-03-12 19:03 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Mar 12, 2004 at 10:44:35AM -0800, Sabharwal, Atul wrote:
> >>Have you tried using udevtest to see if that gives you the same
> result?
> 
> I tried udevtest and it gives same result as udev. The scsi
> commands give three device entries. 

Getting an sda, sda1, and sg1 is the expected behaviour. sg is the "scsi
generic" or scsi pass through interface and ... sda1 a partition of sda.

If you were getting multiple entries in /sys/bus/scsi/devices for the one
command, that would be bad.

The addition and removal of a scsi device using /proc/scsi/scsi (or sysfs
interfaces for a single LUN) is the equivalent of a hotplug removal and
addition of a single scsi device (LUN or disk, not a host and not a scsi
target). These are vary useful for testing udev or other hotplug code,
they can be used with USB mass storage devies and scsi_debug disks.

Also, you can use the sysfs remove/scan interfaces. The /proc ones will go
away someday. The scan interface is nicer for multi-LUN devices as it will
use the REPORT LUNS to scan, and can scan an entire bus, target or just a
single LUN.

To remove a LUN use:

	echo anythinghere > /sys/bus/scsi/devices/H:C:T:L/delete

To scan, general syntax is:

	echo "C T L" > /sys/class/scsi_host/hostH/scan

Where H C T L are respectively the host number, channel, target id, and
lun.

So remove a single LUN at 1 0 0 0 via:

	echo anythinghere > /sys/bus/scsi/devices/1:0:0:0/delete

The scan can be wildcarded via '-'.

To scan all of host1:

	echo "- - -" > /sys/class/scsi_host/host1/scan

Scan a single channel/bus 0:

	echo "0 - -" > /sys/class/scsi_host/host1/scan

Scan target 0:

	echo "0 0 -" > /sys/class/scsi_host/host1/scan

Scan a single LUN:

	echo "0 0 0" > /sys/class/scsi_host/host1/scan

-- Patrick Mansfield


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* RE: Manual udev invocation & via hotplug method gives different results
  2004-03-12  1:26 Manual udev invocation & via hotplug method gives different results Sabharwal, Atul
                   ` (4 preceding siblings ...)
  2004-03-12 19:03 ` Manual udev invocation & via hotplug method gives different results Patrick Mansfield
@ 2004-03-12 19:43 ` Sabharwal, Atul
  2004-03-12 23:50 ` Sabharwal, Atul
  6 siblings, 0 replies; 8+ messages in thread
From: Sabharwal, Atul @ 2004-03-12 19:43 UTC (permalink / raw)
  To: linux-hotplug


>Getting an sda, sda1, and sg1 is the expected behaviour. sg is the
"scsi
>generic" or scsi pass through interface and ... sda1 a partition of
sda.

>If you were getting multiple entries in /sys/bus/scsi/devices for the
one
>command, that would be bad.

I was expecting descriptive names. Not sda. If udevtest can create
descipive
Names, why not the hotplug sequence via udevsend. Is it because the
rules are
Not working with hotplug events ?

>The addition and removal of a scsi device using /proc/scsi/scsi (or
sysfs
>interfaces for a single LUN) is the equivalent of a hotplug removal and
>addition of a single scsi device (LUN or disk, not a host and not a
scsi
>target). These are vary useful for testing udev or other hotplug code,
>they can be used with USB mass storage devies and scsi_debug disks.

>Also, you can use the sysfs remove/scan interfaces. The /proc ones will
go
>away someday. The scan interface is nicer for multi-LUN devices as it
will
>use the REPORT LUNS to scan, and can scan an entire bus, target or just
a
>single LUN.

>To remove a LUN use:

>	echo anythinghere > /sys/bus/scsi/devices/H:C:T:L/delete

>To scan, general syntax is:

>	echo "C T L" > /sys/class/scsi_host/hostH/scan

>Where H C T L are respectively the host number, channel, target id, and
>lun.

>So remove a single LUN at 1 0 0 0 via:

>	echo anythinghere > /sys/bus/scsi/devices/1:0:0:0/delete

>The scan can be wildcarded via '-'.

>To scan all of host1:

>	echo "- - -" > /sys/class/scsi_host/host1/scan

>Scan a single channel/bus 0:

>	echo "0 - -" > /sys/class/scsi_host/host1/scan

>Scan target 0:

>	echo "0 0 -" > /sys/class/scsi_host/host1/scan

>Scan a single LUN:

>	echo "0 0 0" > /sys/class/scsi_host/host1/scan

Thanks a bunch on the SCSI hotplug commands with sysfs. I had been
googling and
could not find any information.

Thanks,

Atul



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&opÌk
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* RE: Manual udev invocation & via hotplug method gives different results
  2004-03-12  1:26 Manual udev invocation & via hotplug method gives different results Sabharwal, Atul
                   ` (5 preceding siblings ...)
  2004-03-12 19:43 ` Sabharwal, Atul
@ 2004-03-12 23:50 ` Sabharwal, Atul
  6 siblings, 0 replies; 8+ messages in thread
From: Sabharwal, Atul @ 2004-03-12 23:50 UTC (permalink / raw)
  To: linux-hotplug

Thanks.  Your e-mail has answered my question. Also, the rule I had
written 
was failing, hence, I was getting sda instead of descriptive names. 
My mistake!!

Regards,

Atul

-------------------------------------------------------------
P.S:  All opinions are my personal opinion(s) & responsibility and do
not represent the view of my employer ( Intel Corporation ).

-----Original Message-----
From: linux-hotplug-devel-admin@lists.sourceforge.net
[mailto:linux-hotplug-devel-admin@lists.sourceforge.net] On Behalf Of
Sabharwal, Atul
Sent: Friday, March 12, 2004 11:44 AM
To: Patrick Mansfield
Cc: linux-hotplug-devel@lists.sourceforge.net
Subject: RE: Manual udev invocation & via hotplug method gives different
results


>Getting an sda, sda1, and sg1 is the expected behaviour. sg is the
"scsi
>generic" or scsi pass through interface and ... sda1 a partition of
sda.

>If you were getting multiple entries in /sys/bus/scsi/devices for the
one
>command, that would be bad.

I was expecting descriptive names. Not sda. If udevtest can create
descipive
Names, why not the hotplug sequence via udevsend. Is it because the
rules are
Not working with hotplug events ?

>The addition and removal of a scsi device using /proc/scsi/scsi (or
sysfs
>interfaces for a single LUN) is the equivalent of a hotplug removal and
>addition of a single scsi device (LUN or disk, not a host and not a
scsi
>target). These are vary useful for testing udev or other hotplug code,
>they can be used with USB mass storage devies and scsi_debug disks.

>Also, you can use the sysfs remove/scan interfaces. The /proc ones will
go
>away someday. The scan interface is nicer for multi-LUN devices as it
will
>use the REPORT LUNS to scan, and can scan an entire bus, target or just
a
>single LUN.

>To remove a LUN use:

>	echo anythinghere > /sys/bus/scsi/devices/H:C:T:L/delete

>To scan, general syntax is:

>	echo "C T L" > /sys/class/scsi_host/hostH/scan

>Where H C T L are respectively the host number, channel, target id, and
>lun.

>So remove a single LUN at 1 0 0 0 via:

>	echo anythinghere > /sys/bus/scsi/devices/1:0:0:0/delete

>The scan can be wildcarded via '-'.

>To scan all of host1:

>	echo "- - -" > /sys/class/scsi_host/host1/scan

>Scan a single channel/bus 0:

>	echo "0 - -" > /sys/class/scsi_host/host1/scan

>Scan target 0:

>	echo "0 0 -" > /sys/class/scsi_host/host1/scan

>Scan a single LUN:

>	echo "0 0 0" > /sys/class/scsi_host/host1/scan

Thanks a bunch on the SCSI hotplug commands with sysfs. I had been
googling and
could not find any information.

Thanks,

Atul



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=ick
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&opÌk
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

end of thread, other threads:[~2004-03-12 23:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-12  1:26 Manual udev invocation & via hotplug method gives different results Sabharwal, Atul
2004-03-12  1:42 ` Greg KH
2004-03-12  1:51 ` Sabharwal, Atul
2004-03-12 18:44 ` Sabharwal, Atul
2004-03-12 18:54 ` Manual udev invocation & via hotplug method gives different Kay Sievers
2004-03-12 19:03 ` Manual udev invocation & via hotplug method gives different results Patrick Mansfield
2004-03-12 19:43 ` Sabharwal, Atul
2004-03-12 23:50 ` Sabharwal, Atul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).