linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Nao Nishijima <nao.nishijima.xt@hitachi.com>
Cc: Greg KH <greg@kroah.com>,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	linux-hotplug@vger.kernel.org, Kay Sievers <kay.sievers@vrfy.org>,
	James Bottomley <James.Bottomley@suse.de>,
	Jon Masters <jcm@redhat.com>,
	2nddept-manager@sdl.hitachi.co.jp
Subject: Re: [PATCH 1/2] SCSI: Add a SCSI option for persistent device names
Date: Fri, 08 Apr 2011 17:21:13 +0000	[thread overview]
Message-ID: <20110408192113.2f3d5eda@stein> (raw)
In-Reply-To: <4D9F17DF.5030601@hitachi.com>

On Apr 08 Nao Nishijima wrote:
> (2011/04/06 1:14), Greg KH wrote:
> > On Tue, Apr 05, 2011 at 09:49:46PM +0900, Nao Nishijima wrote:
> >> Todo:
> >> - usb support
> > 
> > Why?  USB uses scsi, so why would it not work as-is today?  What about
> > libata devices?
> > 
> 
> Sorry, my explanation was not sufficient.
> It is required to get scsi id using a scsi inguiry command in order to
> create the udev rule, especially in ATTR(disk_id) item in it. The USB
> devices, however, do not respond to the command and we can not get their
> scsi id.

Identifiers and names of target ports and of logical units (per SAM-2 and
later, Annex A) --- whether they are persistent, in which scope they are
unique, how they look like, and how they can be obtained --- are transport
specific.

Neither the INQUIRY command (per SPC) nor any other command is generally
useful to obtain e.g. logical unit identifiers.  Any tool that needs to
obtain identifiers or names of target ports and of logical units must talk
with the transport driver through driver-specific interfaces.

Years ago it was suggested on this list that scsi-mod exposes standard
sysfs attributes for target and LU identifiers and names for all devices,
so that tools that need identfiers or names have a single place where they
can look them up.  (The read() method of these attributes would have to
be provided kernel-internally by transport drivers; and tools that read
these attributes need to be aware that there is not a single format for
identifiers and names.)

The SCSI folks were not interested in such a more standardized sysfs ABI
at that time.  (There was only a proposal anyway, not a patch.)  Hence,
tools have to dig at various places for these SAM-2 artifacts.  These ABIs
have been defined ad hoc by the transport driver implementers.

Anyway.  /How/ to obtain identifiers is just a side issue.  Back to the
proposal of letting userland tell the kernel how to name devices:

> >> I create unnamed devices (not
> >> a block device, but an intermediate device.
[...]
> >> After udev finds the unnamed
> >> device, udev assigns a persistent device name to a specific device
> >> according to udev rules and registers it as a block device. Hence,
> >> this is just a naming, not a renaming.

I disagree to this conclusion.  The "unnamed" device most definitely will
have a name before it can be shown to userland.  This preliminary name
fulfills the very same requirement that "s[drt][a-z]+[0-9]*" fulfill
today:  It is unique within the system during the lifetime of the
device.  So, this /is/ renaming, only that the first name is only exposed
to special tools that know of this new ABI.

It seems to me that today's procedure of /not/ renaming devices but of
providing as many alternative additional names as anyone could ever need
(symlinks within /dev/) is more robust.

If the contents of /var/log/messages or the output of iostat etc. is not
what is needed, how about simply filtering that through a grep/ sed based
script that rewrites names?  (This needs to be run during the lifetime of
the device of course, otherwise a wrong name could be put in.)  The fine
symlinks that udev provides can be used in such a text filter.
-- 
Stefan Richter
-===-=-= -=-- -=---
http://arcgraph.de/sr/

  parent reply	other threads:[~2011-04-08 17:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05 12:49 [PATCH 1/2] SCSI: Add a SCSI option for persistent device names in Nao Nishijima
2011-04-05 12:50 ` [PATCH 2/2] SCSI: modify SCSI subsystem Nao Nishijima
2011-04-05 16:14 ` [PATCH 1/2] SCSI: Add a SCSI option for persistent device names Greg KH
2011-04-08 14:12   ` Nao Nishijima
2011-04-08 14:33     ` Hannes Reinecke
2011-04-08 15:14       ` [PATCH 1/2] SCSI: Add a SCSI option for persistent device James Bottomley
2011-04-08 16:14         ` [PATCH 1/2] SCSI: Add a SCSI option for persistent device names Greg KH
2011-04-08 16:43           ` Kay Sievers
2011-04-12 13:23         ` Nao Nishijima
2011-04-12 13:29           ` [PATCH 1/2] SCSI: Add a SCSI option for persistent device James Bottomley
2011-04-14  2:06       ` [PATCH 1/2] SCSI: Add a SCSI option for persistent device names Nao Nishijima
2011-04-14  2:18         ` Greg KH
2011-04-08 17:21     ` Stefan Richter [this message]
2011-04-05 16:14 ` Greg KH
2011-04-08 14:07   ` Nao Nishijima
2011-04-08 16:12     ` Greg KH
2011-04-14  8:15       ` Nao Nishijima
2011-04-14 20:07         ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110408192113.2f3d5eda@stein \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=2nddept-manager@sdl.hitachi.co.jp \
    --cc=James.Bottomley@suse.de \
    --cc=greg@kroah.com \
    --cc=jcm@redhat.com \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nao.nishijima.xt@hitachi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).