public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: /proc/scsi/map
@ 2002-06-15 21:08 Douglas Gilbert
  0 siblings, 0 replies; 31+ messages in thread
From: Douglas Gilbert @ 2002-06-15 21:08 UTC (permalink / raw)
  To: Andries.Brouwer; +Cc: linux-scsi, linux-kernel, Kurt Garloff

Andries.Brouwer@cwi.nl wrote:

> > How can one assign stable device names to SCSI devices in
> > case there are devices that may or may not be switched on or connected.
> 
> An interesting unsolved problem.
> [Your discussion confuses a few things, especially in the context
> of removable devices: a uuid lives on the disk, the C,B,T,U tends
> to identify the drive rather than the disk.]

In the lsml "[RFC] Persistent naming of scsi devices" thread
Martin K. Petersen <mkp@mkp.net> summarized scsi addressing issues
thus:
#
# What we want is (at least) three ways of addressing a device:
#
# 1. By content.  This is the persistent naming.  Think
#    filesystem/MD/LVM UUID.  This is what you put in /etc/fstab and
#    what metadisk systems use to assemble logical volumes.
#
#    Content referencing is used for accessing data.
#
# 2. By physical path.  This naming is not persistent.  Not even runtime
#    because hotplug, iSCSI and whatnot may mess things up.
#
#    Path naming is for discovery and recovery.  When you add an
#    unlabeled disk you want to reference it by path to give it a name.
#    When you have a failed disk on your system you want to know which
#    physical device to pull from the array.
#
# 3. By enumeration.  This is what the kernel happens to be using to
#    reference the device.  diskN.  Certainly not persistent.
#
#    Enumeration is for the kernel.

The /proc/scsi/map facility proposed by Kurt does a very
good job at tying together points 2) and 3) . As a bonus
it also shows the sg device to primary device mapping
(which is a major headache for me as the sg maintainer).

As for the physical path getting fooled by a re-plug, I would 
like to present the idea of a "device attach event number" 
which would be uniquely issued (ascending order) to each newly 
attached scsi device [an attach timestamp could be useful as well].
This is easy to implement, has a many-to-one
relationship with the physical path (i.e. C,B,T,U) but, at
any instant, has a one-to-one relationship. So the attach
event number can be used as an alias for C,B,T,U** and makes
no pretensions to be persistent from one kernel lifetime
to the next (on the same machine). The scsimon driver supports
a device "attach event number". If the idea is workable the
number should probably be put in the scsi mid-level (i.e.
Scsi_Device structure).

** The C,B,T,U tuple (or nexus) is already a handful and
will probably get uglier with 8-byte luns and iSCSI extensions.
The SCSI_IOCTL_GET_IDLUN tries to pack C,B,T,U into one integer
and obviously won't scale to an 8 byte lun. A new ioctl such as
SCSI_IOCTL_GET_PHYSICAL_PATH (for example) could fix "GET_IDLUN"'s
shortcomings and yield the device attach event number. 


Mike Sullivan (who started the above-mentioned "[RFC] Persistent 
naming of scsi devices" thread) recently presented patches on
lsml for a devnaming (and scsiname) utility. These patches  
address Martin's point 1) [content addressing].


There remains the issue of removable media (i.e. device stays
put but the media is changed). In the absence of asynchronous
event notification, the next (normal) scsi command receives a
"unit attention" to alert the kernel. I'm not sure if Mike's
patch addresses this issue.

> > Life would be easier if the scsi subsystem would just report which
> > SCSI device (uniquely identified by the controller,bus,target,unit tuple)
> > belongs to which high-level device.
> 
> Yes. I took your patch, ported it to 2.5, and tried it out.
> 
> # cat /proc/scsi/map
> # C,B,T,U       Type    onl     sg_nm   sg_dev  nm      dev(hex)
> 1,0,06,00       0x00    1       sg0     c:15:00 sda     b:08:00
> 2,0,00,00       0x00    1       sg1     c:15:01 sdb     b:08:10
> 2,0,00,01       0x00    1       sg2     c:15:02 sdc     b:08:20
> 3,0,00,00       0x00    1       sg3     c:15:03 sdd     b:08:30
> 3,0,00,01       0x00    1       sg4     c:15:04 sde     b:08:40
> 
> Very good - in combination with /proc/scsi/scsi this gives
> good information. I like it.

Adding INQUIRY strings would make it harder to parse and more
cluttered for humans to read.

> But just "cat /proc/scsi/map" is not good enough.
> From the above output alone one cannot easily guess which is which.
> One would need a small utility that reads /proc/scsi/map and
> /proc/scsi/scsi and produces something readable.

Note the possible race condition: reading /proc/scsi/scsi
then /proc/scsi/map (or vice versa) when a hotplug is
occurring...

BTW In lk 2.5 we store the whole INQUIRY response in the
Scsi_Device structure. Currently we have no ioctl to yield
this information to the user space :-(

> Will add sth to util-linux in case this gets accepted.

IMO as soon as lk 2.4.19 comes out, this patch should
be presented to Marcelo (for inclusion in lk 2.4.20). The 
sooner we get it into the lk 2.5 series the better. Could you 
forward your lk 2.5 version of Kurt's patch to Linus (and the
linux-scsi list)?

Doug Gilbert

^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: /proc/scsi/map
@ 2002-06-18 20:06 Chris Adams
  2002-06-18 20:25 ` /proc/scsi/map Andreas Dilger
  0 siblings, 1 reply; 31+ messages in thread
From: Chris Adams @ 2002-06-18 20:06 UTC (permalink / raw)
  To: linux-kernel

Once upon a time, Doug Ledford  <dledford@redhat.com> said:
>Umm, this patently fails to meet the criteria you posted of "stable device 
>name".  Adding a controller to a system is just as likely to blow this 
>naming scheme to hell as it is to blow the traditional linux /dev/sd? 
>scheme.  IOW, even though the /proc/scsi/map file looks nice and usefull, 
>it fails to solve the very problem you are trying to solve.

I use OSF/1^WDigital Unix^WCompaq^WHP Tru64 Unix here at work, and with
version 5, they've got a nice persistent device naming system (I don't
claim to know how it works however).  The first hard drive found is
/dev/disk/dsk0, the second is /dev/disk/dsk1, etc.  It doesn't matter
how you get to the drive (which is important if you want multipathing -
the controller and bus should NOT figure into the device name or you are
going to have problems).  If you remove dsk0, there won't be another
dsk0 (unless you clean it out of the device database).

-- 
Chris Adams <cmadams@hiwaay.net>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.

^ permalink raw reply	[flat|nested] 31+ messages in thread
* RE: /proc/scsi/map
@ 2002-06-17 12:55 Heinz, Michael
  0 siblings, 0 replies; 31+ messages in thread
From: Heinz, Michael @ 2002-06-17 12:55 UTC (permalink / raw)
  To: Sancho Dauskardt, Kurt Garloff, Linux kernel list,
	Linux SCSI list
  Cc: linux-usb-devel, linux1394-devel

>From an infiniband point of view, this sounds great!

--
Michael Heinz
Infinicon Systems, Inc.
http://www.infiniconsys.com 

> -----Original Message-----
> From: Sancho Dauskardt [mailto:sancho@dauskardt.de]
> Sent: Saturday, June 15, 2002 3:50 PM
> To: Kurt Garloff; Linux kernel list; Linux SCSI list
> Cc: linux-usb-devel@lists.sourceforge.net;
> linux1394-devel@lists.sourceforge.net
> Subject: Re: /proc/scsi/map
> 
> 
> 
> >Life would be easier if the scsi subsystem would just report 
> which SCSI
> >device (uniquely identified by the 
> controller,bus,target,unit tuple) belongs
> >to which high-level device. The information is available in 
> the kernel.
> >
> >Attached patch does this:
> >garloff@pckurt:/raid5/Kernel/src $ cat /proc/scsi/map
> ># C,B,T,U       Type    onl     sg_nm   sg_dev  nm      dev(hex)
> >0,0,00,00       0x05    1       sg0     c:15:00 sr0     b:0b:00
> [...]
> 
> Great, this was really missing badly.
> 
> But how about adding another column: GUID.
> Most usb-storage and (all?) FireWire devices have such a 
> unique identitiy.
> In contrast to native SCSI devices, these emulated SCSI devices on 
> hot-plugging busses will change their LUNs/IDs. Therefor the 
> GUID is really 
> a must to be able to create stable names (laptop suspend, etc.).
> 
> Both usb-storage and iee1394-sbp2 know the GUID. It only needs to be 
> communicated..
> 
> I'd guess that FibreChannel has similar problems ?
> 
> - sda
> 
> -
> 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] 31+ messages in thread
* Re: /proc/scsi/map
@ 2002-06-16 15:59 Borsenkow Andrej
  0 siblings, 0 replies; 31+ messages in thread
From: Borsenkow Andrej @ 2002-06-16 15:59 UTC (permalink / raw)
  To: linux-kernel list



> # cat /proc/scsi/map
> # C,B,T,U Type onl sg_nm sg_dev nm dev(hex)
> 1,0,06,00 0x00 1 sg0 c:15:00 sda b:08:00
> 2,0,00,00 0x00 1 sg1 c:15:01 sdb b:08:10
> 2,0,00,01 0x00 1 sg2 c:15:02 sdc b:08:20
> 3,0,00,00 0x00 1 sg3 c:15:03 sdd b:08:30
> 3,0,00,01 0x00 1 sg4 c:15:04 sde b:08:40

The device names <-> SCSI addresses is just a part of problem. You still
are not able to assign permanent controller numbers. If you have two
SCSI controllers there is no (general) way to assure that one of them
gets 1 and another 2. (It is possible to some extent with scsihosts
parameter but only if two controllers use different drivers). Which
means that if for some reason one of them is not present (failed) you
suddenly get wrong addresses - _totally_ wrong addresses.

In some cases (LAN interfaces) it may even lead to interesting security
problem.

What is needed is a _generic_ way to assign logical controller numbers
for physical devices. Legacy devices may be ignored in this respect, but
when you have unambiguous device address (like PCI) it is possible. 

-andrej



^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: /proc/scsi/map
@ 2002-06-15 23:00 Andries.Brouwer
  0 siblings, 0 replies; 31+ messages in thread
From: Andries.Brouwer @ 2002-06-15 23:00 UTC (permalink / raw)
  To: Andries.Brouwer, dougg; +Cc: garloff, linux-kernel, linux-scsi

    From dougg@torque.net  Sat Jun 15 23:10:06 2002

    In the lsml "[RFC] Persistent naming of scsi devices" thread
    Martin K. Petersen <mkp@mkp.net> summarized scsi addressing issues
    thus:
    #
    # What we want is (at least) three ways of addressing a device:
    #
    # 1. By content.  This is the persistent naming.  Think
    #    filesystem/MD/LVM UUID.  This is what you put in /etc/fstab and
    #    what metadisk systems use to assemble logical volumes.
    #
    #    Content referencing is used for accessing data.
    #
    # 2. By physical path.  This naming is not persistent.  Not even runtime
    #    because hotplug, iSCSI and whatnot may mess things up.
    #
    #    Path naming is for discovery and recovery.  When you add an
    #    unlabeled disk you want to reference it by path to give it a name.
    #    When you have a failed disk on your system you want to know which
    #    physical device to pull from the array.
    #
    # 3. By enumeration.  This is what the kernel happens to be using to
    #    reference the device.  diskN.  Certainly not persistent.
    #
    #    Enumeration is for the kernel.

Yes, a very nice summary. Maybe also

# 4. By fingerprint.  This naming is persistent, but need not
#    identify the device uniquely.  Think device type, vendor,
#    serial number, capacity.
#
#    Fingerprints are convenient for the user. "My ZIP drive".


    The /proc/scsi/map facility proposed by Kurt does a very
    good job at tying together points 2) and 3) .

Yes. Or, more precisely, it ties together the name sde and the
path (C,B,T,U) = (3,0,00,01). However, this path is not very
"physical". Indeed, these four numbers all arose by enumeration -
they are kernel numbers for some usb-storage device.

I can find the physical path, but that requires quite some digging in
/proc/scsi/scsi and /proc/scsi/sg/host_strs and /proc/scsi/usb-storage*/*
and /proc/bus/usb/devices.


    > Very good - in combination with /proc/scsi/scsi this gives
    > good information. I like it.

    Adding INQUIRY strings would make it harder to parse and more
    cluttered for humans to read.

Yes, I would like to leave that to a user-space utility.
Writing that will also show what kernel facilities are missing.

    > But just "cat /proc/scsi/map" is not good enough.
    > From the above output alone one cannot easily guess which is which.
    > One would need a small utility that reads /proc/scsi/map and
    > /proc/scsi/scsi and produces something readable.

    Note the possible race condition: reading /proc/scsi/scsi
    then /proc/scsi/map (or vice versa) when a hotplug is
    occurring...

Already reading /proc/scsi/map has a race: no locking is done.

    > Will add sth to util-linux in case this gets accepted.

    IMO as soon as lk 2.4.19 comes out, this patch should
    be presented to Marcelo (for inclusion in lk 2.4.20).

Yes, perhaps. I would like to get some experience first,
play with it, see what information is missing.

I have to admit that 2.5 is not very suitable for development
these days, it is not stable enough, but the appropriate path
is to try things out in 2.5 first, and when something crystallizes
out, backport.

    The sooner we get it into the lk 2.5 series the better. Could you 
    forward your lk 2.5 version of Kurt's patch to Linus (and the
    linux-scsi list)?

Yes, but I'll wait for 2.5.22 so that it is clear against
what tree to diff.

Andries

^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: /proc/scsi/map
@ 2002-06-15 21:54 Andries.Brouwer
  2002-06-15 22:27 ` /proc/scsi/map Douglas Gilbert
  2002-06-15 22:28 ` /proc/scsi/map Sancho Dauskardt
  0 siblings, 2 replies; 31+ messages in thread
From: Andries.Brouwer @ 2002-06-15 21:54 UTC (permalink / raw)
  To: garloff, linux-kernel, linux-scsi, sancho
  Cc: linux-usb-devel, linux1394-devel

    >Life would be easier if the scsi subsystem would just report which SCSI
    >device (uniquely identified by the controller,bus,target,unit tuple) belongs
    >to which high-level device. The information is available in the kernel.
    >
    >Attached patch does this:
    >garloff@pckurt:/raid5/Kernel/src $ cat /proc/scsi/map
    ># C,B,T,U       Type    onl     sg_nm   sg_dev  nm      dev(hex)
    >0,0,00,00       0x05    1       sg0     c:15:00 sr0     b:0b:00
    [...]

    Great, this was really missing badly.

    But how about adding another column: GUID.
    Most usb-storage and (all?) FireWire devices have such a unique identitiy.
    In contrast to native SCSI devices, these emulated SCSI devices on 
    hot-plugging busses will change their LUNs/IDs. Therefor the GUID is
    really a must to be able to create stable names (laptop suspend, etc.).

    Both usb-storage and iee1394-sbp2 know the GUID. It only needs to be 
    communicated..

The usb-storage GUID is just one random item of information.
One might wish for much more.

And: this information is already somewhere:

% cat /proc/scsi/sg/host_strs
SCSI host adapter emulation for IDE ATAPI devices
Iomega VPI2 (imm) interface
SCSI emulation for USB Mass Storage devices
SCSI emulation for USB Mass Storage devices
%

This tells me that host 0 will be in ide-scsi, host 1 in imm,
host 2 in usb-storage-0, host 3 in usb-storage-1.
And

% cat /proc/scsi/ide-scsi/0
SCSI host adapter emulation for IDE ATAPI devices
% cat /proc/scsi/imm/1
Version : 2.05 (for Linux 2.4.0)
Parport : parport0
Mode    : SPP
% cat /proc/scsi/usb-storage-0/2
   Host scsi2: usb-storage
       Vendor: DataFab Systems Inc.
      Product: USB CF+SM
Serial Number: 5DC69477C6
     Protocol: Transparent SCSI
    Transport: Datafab Bulk-Only
         GUID: 07c4a1090000005dc69477c6
     Attached: Yes
% cat /proc/scsi/usb-storage-1/3
   Host scsi3: usb-storage
       Vendor: SCM Microsystems Inc.
      Product: eUSB SmartMedia / CompactFlash 
Serial Number: None
     Protocol: Transparent SCSI
    Transport: Control/Bulk-EUSB/SDDR09
         GUID: 04e600050000000000000000
     Attached: Yes
%

A small utility that looks around in /proc is able to
find the GUID. Of course it would be better when fewer
heuristics were required.

Finally, the GUIDs you see here do not determine the LUN.
So, there is no well-defined line in /proc/scsi/map
where they would belong.

Andries

^ permalink raw reply	[flat|nested] 31+ messages in thread
* Re: /proc/scsi/map
@ 2002-06-15 16:04 Andries.Brouwer
  2002-06-16 21:04 ` /proc/scsi/map Kurt Garloff
  0 siblings, 1 reply; 31+ messages in thread
From: Andries.Brouwer @ 2002-06-15 16:04 UTC (permalink / raw)
  To: garloff; +Cc: linux-kernel

> How can one assign stable device names to SCSI devices in
> case there are devices that may or may not be switched on or connected.

An interesting unsolved problem.
[Your discussion confuses a few things, especially in the context
of removable devices: a uuid lives on the disk, the C,B,T,U tends
to identify the drive rather than the disk.]

> Life would be easier if the scsi subsystem would just report which
> SCSI device (uniquely identified by the controller,bus,target,unit tuple)
> belongs to which high-level device.

Yes. I took your patch, ported it to 2.5, and tried it out.

# cat /proc/scsi/map
# C,B,T,U       Type    onl     sg_nm   sg_dev  nm      dev(hex)
1,0,06,00       0x00    1       sg0     c:15:00 sda     b:08:00
2,0,00,00       0x00    1       sg1     c:15:01 sdb     b:08:10
2,0,00,01       0x00    1       sg2     c:15:02 sdc     b:08:20
3,0,00,00       0x00    1       sg3     c:15:03 sdd     b:08:30
3,0,00,01       0x00    1       sg4     c:15:04 sde     b:08:40

Very good - in combination with /proc/scsi/scsi this gives
good information. I like it.

But just "cat /proc/scsi/map" is not good enough.
>From the above output alone one cannot easily guess which is which.
One would need a small utility that reads /proc/scsi/map and
/proc/scsi/scsi and produces something readable.
Will add sth to util-linux in case this gets accepted.

Andries



^ permalink raw reply	[flat|nested] 31+ messages in thread
[parent not found: <garloff@suse.de>]

end of thread, other threads:[~2002-06-18 20:26 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-15 21:08 /proc/scsi/map Douglas Gilbert
  -- strict thread matches above, loose matches on Subject: below --
2002-06-18 20:06 /proc/scsi/map Chris Adams
2002-06-18 20:25 ` /proc/scsi/map Andreas Dilger
2002-06-17 12:55 /proc/scsi/map Heinz, Michael
2002-06-16 15:59 /proc/scsi/map Borsenkow Andrej
2002-06-15 23:00 /proc/scsi/map Andries.Brouwer
2002-06-15 21:54 /proc/scsi/map Andries.Brouwer
2002-06-15 22:27 ` /proc/scsi/map Douglas Gilbert
2002-06-15 22:40   ` /proc/scsi/map Sancho Dauskardt
2002-06-16 20:36     ` /proc/scsi/map Kurt Garloff
2002-06-15 22:28 ` /proc/scsi/map Sancho Dauskardt
2002-06-15 16:04 /proc/scsi/map Andries.Brouwer
2002-06-16 21:04 ` /proc/scsi/map Kurt Garloff
     [not found] <garloff@suse.de>
2002-06-15 13:36 ` /proc/scsi/map Kurt Garloff
2002-06-15 14:08   ` /proc/scsi/map John Summerfield
2002-06-17 11:33     ` /proc/scsi/map Kurt Garloff
2002-06-15 15:52   ` /proc/scsi/map Richard Gooch
2002-06-16 19:41     ` /proc/scsi/map Kurt Garloff
2002-06-17 17:49       ` /proc/scsi/map Ingo Oeser
2002-06-15 19:49   ` /proc/scsi/map Sancho Dauskardt
2002-06-16 19:24   ` /proc/scsi/map Albert D. Cahalan
2002-06-16 21:22     ` /proc/scsi/map Kurt Garloff
2002-06-17 20:35   ` /proc/scsi/map Patrick Mansfield
2002-06-17 20:57     ` /proc/scsi/map Kurt Garloff
2002-06-17 21:47       ` /proc/scsi/map Patrick Mansfield
2002-06-17 22:08   ` /proc/scsi/map Doug Ledford
2002-06-17 23:06     ` /proc/scsi/map Kurt Garloff
2002-06-18  2:40       ` /proc/scsi/map Doug Ledford
2002-06-18  4:32         ` /proc/scsi/map Douglas Gilbert
2002-06-18  5:12           ` /proc/scsi/map Doug Ledford
2002-06-18  9:03         ` /proc/scsi/map Kurt Garloff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox