Re: [PATCH] /proc/scsi/map

From: Kurt Garloff (garloff@suse.de)
Date: Thu Jun 20 2002 - 06:25:43 EST


Hi Linus,

On Wed, Jun 19, 2002 at 10:03:16PM -0700, Linus Torvalds wrote:
> On Thu, 20 Jun 2002, Kurt Garloff wrote:
> >
> > find attached a patch (against 2.5.23-dj2) to the SCSI subsystem which
> > adds a file /proc/scsi/map, which provides a listing of SCSI devices,
> > enumerated by the CBTU/HCIL tuple and the high-level devices attached to
> > them.
>
> I really despise this.

Thanks for your feedback.

Actually, I think you want to address a different problem than I want to.

I do believe that the scsi subsystem does not expose enough information for
many things.

Look at /proc/scsi/scsi: The information is useful for the reader who wants
to know what devices he has and were found by the SCSI subsystem.

And completely useless for any program that wants to find a scanner,
CD-Writer, ... as there is no connection to the high-level drivers attached
to them. Which means that all these programs basically contain their own
SCSI scanning code, which means opnening all sg devices and collecting the
information. I do not think that this is a good idea that a lot of userspace
programs need to do a lot of effort to get some information that could just
be exported by the kernel.

But I indeed had persistent naming in mind as well and mentioned it, so this
is probably why the discussion went that way.
scsidev, which I took over from Eric Youngdale some time ago, tries to
provide persistent naming for SCSI devices and suffers the problem, that
it can't work reliably, as open() of sr/st/osst devices can fail because
devices are already in use (-EBUSY) or have no medium inserted. (O_NONBLOCK
does not always help.) And it can take considerable time or cause unwanted
side-effects.

You're right that just enumerating all scsi devices in a somewhat more
persistent way does not constitute a complete solution to the problem of
persistent naming of attached storage devices. That is something that would
need to be addressed at a higher level and not inside SCSI midlevel, of
course.

But I still think the SCSI subsystem should report which SCSI (low-level)
device is mapped to what high-level driver.
Would you accept a patch that adds a line like

Host: scsi3 Channel: 00 Id: 12 Lun: 00
  Vendor: IBM Model: DPSS-336950N Rev: S84D
  Type: Direct-Access ANSI SCSI revision: 03
  Attached drivers: sg12(c:15:0c) sdf(b:08:50)
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
to /proc/scsi/scsi ?

Actually that was my first idea, but I was reluctant to change the format of
an existing file, as it might be parsed by existing code.
But, given the uselessness of /proc/scsi/scsi for code, I guess that's
a small risk ...

> It's just _wrong_ to have one file with a collection of devices in it, and
> it is _doubly_ wrong when that one file
>
> - is limited to a (arbitrary) subset of the disks in your system

You mean all disks driven by the SCSI subsystem, right?

> - has completely bogus information about "location" that has nothing to
> do with real life, yet pruports to be an "address" even though it
> obviously isn't.

The CBTU tuple uniquely addresses a SCSI device in a running system.
It's just not persistent against configuration changes, unfortunately.
But it's reported by /proc/scsi/scsi as well and therefore useful to
find back in map, IMHO.

[...]
> Either you enumerate things without any structure (like the current SCSI
> layer does: disk0, disk1, disk2 ...) or you give full their addresses.
> Don't do the half-assed thing.

I would certainly like to see code at block layer that does provide the
infrastructure to see persistent names for all sort of attached devices,
especially disks.

> PLEASE don't add these kinds of SCSI-specific hacks, that are _useless_ to
> find other types of disks, and that makes no sense, and will not work for
> things like DAC960, for IDE, or for anything else that just ignores the
> SCSI layer (even if it physically uses SCSI disks, like the DAC960 setup).

Please consider the possibility of adding the reporting of the attached
high-level drivers to /proc/scsi/scsi

Regards,

-- 
Kurt Garloff  <garloff@suse.de>                          Eindhoven, NL
GPG key: See mail header, key servers         Linux kernel development
SuSE Linux AG, Nuernberg, DE                            SCSI, Security


- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jun 23 2002 - 22:00:21 EST