linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "device busy" error when registering device
@ 2014-07-19  0:11 Ian Pilcher
  2014-07-19  7:23 ` Josep Lladonosa
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ian Pilcher @ 2014-07-19  0:11 UTC (permalink / raw)
  To: linux-bcache

I just finished moving my existing Fedora 20 root filesystem onto a
bcache device (actually LVM on top of a bcache physical volume).

The bcache cache device is /dev/sda2, a partition on my SSD; the backing
device is /dev/md126p5, a partition on an Intel RAID (imsm) volume.

This configuration only boots successfully about 50% of the time.  The
other 50% of the time, the bcache device is not created, and dracut
times out and dumps me into an emergency shell.

After changing the bcache-register script to use /sys/fs/bcache/register
(instead of register_quiet), I see a "device busy" error when udev
attempts to register the backing device:

  [    2.105581] bcache: register_bcache() error opening /dev/md126p5:
device busy

This is kernel 3.5.15, so this doesn't mean that the device is already
registered; something else has it (temporarily) opened.  I say that it's
opened temporarily, because I am able to register the backing device
manually from the dracut shell -- which starts the the bcache device.

Looking at /usr/lib/udev/bcache-register and the bcache_register source
in drivers/md/bcache/super.c, I notice 2 things.

(1) bcache-register gives up immediately when an error occurs because of
    a (possibly temporary) conflict.

(2) Although the driver logs a different message in the already
    registered case ("device already registered" instead of "device
    busy"), it doesn't provide userspace with any way to distinguish the
    two cases; it always returns -EINVAL.

Suggested fix:

(1) Change bcache_register to return -EBUSY in the device busy case
    (while still returning -EINVAL in the already registered case).

(2) Change bcache-register to check the exit code of the registration
    attempt and retry in the EBUSY case.

Does this make sense?

-- 
========================================================================
Ian Pilcher                                         arequipeno@gmail.com
-------- "I grew up before Mark Zuckerberg invented friendship" --------
========================================================================

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-09-06  7:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-19  0:11 "device busy" error when registering device Ian Pilcher
2014-07-19  7:23 ` Josep Lladonosa
2014-07-22  4:46   ` Ian Pilcher
2014-07-22  5:13 ` RFC: Handle "device busy" error when registering Ian Pilcher
2014-07-23  3:43   ` Ian Pilcher
2014-08-13 20:24 ` "device busy" error when registering device Rolf Fokkens
2014-08-20  1:38   ` Ian Pilcher
2014-09-06  7:34     ` Rolf Fokkens

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).