mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Aloni <da-x@monatomic.org>
To: linux-usb-devel@lists.sourceforge.net
Cc: Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Dealing with flaky USB storage devices and rootfs
Date: Tue, 29 May 2007 23:59:27 +0300	[thread overview]
Message-ID: <20070529205927.GA24808@localdomain> (raw)

Hello,

We have a system where the rootfs is a partition on a USB device,
and I've noticed upon a few rare cases where the USB controller 
loses the connection to the USB device after some uptime (days,
weeks...), and the USB device reappears a very short time later.

It doesn't really matter why, I guess that USB controllers and
storage devices aren't always of the best quality - let's assume
that. The issue is that Linux currently makes it problematic
to recover the rootfs for several reasons.

If /dev/sda1 is mounted as root and the SCSI device goes into 
offline mode, it is quite impossible to get out of this situation.
At first, I had to disable the usermode helper that sends events 
to udev since it blocks on the dysfunction /dev/sda1. Afterwards, 
I noticed that the reappearing device is being assigned with 
/dev/sdb along with a new SCSI host. I guess the the VFS and 
block layer still keep a reference to the old scsi_disk and as 
a result sd doesn't free it.

So, I gave some thoughts about this, I and came up with two 
main solutions:

1) Improve the USB storage error handling - bind the already 
existing SCSI host to the USB port that has the device, e.g., 
if host2 got created for usb 5-3 then keep it that way for the 
sake of EH. /dev/sda1 should come to life when the USB device 
recovers, unless a few seconds have passed or some attributes 
(such as manufactor id or serial) have changed.

2) Block layer hack - Write a special layering block device 
driver that acts as a proxy to the currently functioning 
/dev/sd* which gets auto-detected by this block layer driver. 
md multipath for the 'poor', you might say..

I chose '2' for the time being. It was much easier than hacking
around the USB subsystem... Yes, I know rootfs on USB is an
uncommon use-case at the moment but I do like to know if there 
are some improvements planned in this area.

-- 
Dan Aloni
XIV LTD, http://www.xivstorage.com
da-x (at) monatomic.org, dan (at) xiv.co.il

             reply	other threads:[~2007-05-29 20:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-29 20:59 Dan Aloni [this message]
2007-05-29 21:50 ` [linux-usb-devel] " Alan Stern
2007-05-30  0:05   ` Dan Aloni
2007-05-30 16:29     ` Alan Stern

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=20070529205927.GA24808@localdomain \
    --to=da-x@monatomic.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    /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

all inboxes | Powered by JetHome®