All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Webb <chris@arachsys.com>
To: James Bottomley <James.Bottomley@suse.de>
Cc: Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>,
	linux-scsi@vger.kernel.org,
	Arjan van de Ven <arjan@infradead.org>
Subject: Re: scsi_wait_scan not working (2.6.30.5)
Date: Wed, 26 Aug 2009 15:34:31 +0100	[thread overview]
Message-ID: <20090826143431.GA4368@arachsys.com> (raw)
In-Reply-To: <1251228529.7539.8.camel@mulgrave.site>

James Bottomley <James.Bottomley@suse.de> writes:

> It's caused by the sd async patches.  What's happening is wait_scan is
> waiting until all the scans are complete, but now sd attachment may not
> be completed by the time that happens.  So, although you have a scanned
> disk, you can't mount it without and attached sd driver. Hopefully when
> all initrds are configured to wait until root appears, this problem will
> go away.

This change has been causing me some puzzlement working out the right way to do
things in our infrastructure management code. Imagine I want a shell function
which takes a host and target name and returns a device node name, ready to
use. (In practice the login and logout functions would do reference counting to
avoid multiple logins to the same target for different consumers, and set up
device mapper targets and so on, but we can ignore that here.)

Previously, because iscsiadm --login does the equivalent of

  echo - - -  > /sys/class/scsi_host/hostX/scan

it was sufficient for me to do udevadm settle and then something like

  shopt -s nullglob
  local SESSION TARGET SESSION BLOCK KERNEL
  for SESSION in /sys/class/scsi_host/host*/device/session*; do
    for TARGET in $SESSION/iscsi_session/*/targetname; do
      [ "`< "$TARGET"`" = "$1" ] || continue
      for BLOCK in "$SESSION"/target*/*/block/*; do
        KERNEL=${BLOCK##*/}
        echo /dev/$KERNEL
        return $SUCCESS
      done
    done
  done
  return $EMISSING

to find my block device. Now I can't do that, and it's not obvious what the
official way is to block until the outstanding async sd attachment has
completed. Maybe I'm going about this completely the wrong way? Polling in a
loop with a sleep isn't very nice, and clearly can't be how people are meant to
do this, but everything else I've come up with is worse or more intrusive to
the system.

Cheers,

Chris.

  parent reply	other threads:[~2009-08-26 14:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-25 19:24 scsi_wait_scan not working (2.6.30.5) Arkadiusz Miskiewicz
2009-08-25 19:28 ` James Bottomley
2009-08-25 19:44   ` Arkadiusz Miskiewicz
2009-08-25 19:47     ` James Bottomley
2009-08-25 20:01       ` Arkadiusz Miskiewicz
2009-08-25 21:22         ` Arkadiusz Miskiewicz
2009-08-25 23:15           ` Alan Stern
2009-08-29 23:27             ` Arkadiusz Miskiewicz
2009-08-30  3:07               ` Alan Stern
2009-08-30  8:12                 ` Arkadiusz Miskiewicz
2009-08-30 17:21                   ` Alan Stern
2009-08-26 14:34   ` Chris Webb [this message]
2009-08-26 15:40     ` James Bottomley
2009-08-26 16:23       ` Chris Webb

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=20090826143431.GA4368@arachsys.com \
    --to=chris@arachsys.com \
    --cc=James.Bottomley@suse.de \
    --cc=a.miskiewicz@gmail.com \
    --cc=arjan@infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    /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 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.