]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: ignore device open failures in __btrfs_open_devices
authorEric Sandeen <sandeen@redhat.com>
Thu, 4 Apr 2013 20:45:08 +0000 (20:45 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Mon, 6 May 2013 19:54:36 +0000 (15:54 -0400)
commitae3451cbfb51f337a13988d7b22372e9b0f1851f
tree5e355349258168b4eb2a0600a794e5697c8a9ae6
parentfaf309876dd23764eb95d1ce4bfc6a6b3809d351
btrfs: ignore device open failures in __btrfs_open_devices

This:

   # mkfs.btrfs /dev/sdb{1,2} ; wipefs -a /dev/sdb1; mount /dev/sdb2 /mnt/test

would lead to a blkdev open/close mismatch when the mount fails, and
a permanently busy (opened O_EXCL) sdb2:

   # wipefs -a /dev/sdb2
   wipefs: error: /dev/sdb2: probing initialization failed: Device or resource busy

It's because btrfs_open_devices() may open some devices, fail on
the last one, and return that failure stored in "ret."   The mount
then fails, but the caller then does not clean up the open devices.

Chris assures me that:

"btrfs_open_devices just means: go off and open every bdev you can from
this uuid.  It should return success if we opened any of them at all."

So change the logic to ignore any open failures; just skip processing
of that device.  Later on it's decided whether we have enough devices
to continue.

Reported-by: Jan Safranek <jsafrane@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/volumes.c