Bug 872831 - wipefs error: /dev/sda: probing initialization failed: Device or resource busy
Summary: wipefs error: /dev/sda: probing initialization failed: Device or resource busy
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: util-linux
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Karel Zak
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-11-03 17:14 UTC by Richard W.M. Jones
Modified: 2013-04-10 14:38 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-03 14:24:56 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2012-11-03 17:14:18 UTC
Description of problem:

We use wipefs as part of the libguestfs tests, and I've noticed
two (related) changes recently.  One is not a bug, the other
seems to be a bug.

First change: You can no longer wipe a mounted filesystem, eg:
 mount /dev/sda1 /foo
 wipefs -a /dev/sda1
fails with:
 /dev/sda1: probing initialization failed: Device or resource busy

That is obviously NOT a bug.  You don't want to be able to
wipe a filesystem which the kernel has mounted.

However a second error looks like it is a bug:

 wipefs -a /dev/sda
 /dev/sda: probing initialization failed: Device or resource busy

In this second case, /dev/sda contains partitions, but nothing is
mounted.  Obviously I want to erase the partitions which is the
whole point of running wipefs(!)

Version-Release number of selected component (if applicable):

util-linux.x86_64 0:2.22.1-3.fc19
(for other packages, see:
http://kojipkgs.fedoraproject.org//work/tasks/1830/4651830/root.log)

How reproducible:

100%

Steps to Reproduce:
1. Run the libguestfs tests on Rawhide.

Additional info:

Example of the second failure:
http://kojipkgs.fedoraproject.org//work/tasks/1830/4651830/build.log

Comment 1 Richard W.M. Jones 2012-11-03 18:29:55 UTC
This worked with util-linux 2.22.1-1.fc19 & coreutils 8.17.
It was when I upgraded to util-linux 2.22.1-3 & coreutils 8.20
that it breaks.

Comment 2 Richard W.M. Jones 2012-11-19 15:42:26 UTC
Patch posted to add --force option:
http://article.gmane.org/gmane.linux.utilities.util-linux-ng/6801

Comment 3 Richard W.M. Jones 2012-11-19 15:45:43 UTC
Here is the libguestfs patch that this was tested alongside:
https://www.redhat.com/archives/libguestfs/2012-November/msg00028.html

Comment 4 Karel Zak 2012-11-20 13:47:41 UTC
(In reply to comment #0)
> However a second error looks like it is a bug:
> 
>  wipefs -a /dev/sda
>  /dev/sda: probing initialization failed: Device or resource busy
> 
> In this second case, /dev/sda contains partitions, but nothing is
> mounted. 

I have doubts that nothing is mounted... partitioned device, 
nothing mounted:

  # strace -e open ./wipefs --no-act -a /dev/sdb 2>&1 | grep sdb
  open("/dev/sdb", O_RDWR|O_EXCL)         = 3

  success!

partitioned device, sdb1 mounted:

  # mount /dev/sdb1 /mnt/test

  # strace -e open ./wipefs --no-act -a /dev/sdb 2>&1 | grep sdb
  open("/dev/sdb", O_RDWR|O_EXCL)         = -1 EBUSY (Device or resource busy)

it means that partition table has no impact to O_EXCL, the problem is if any partition is mounted.

It all seems like correct and expected ... I think we don't want to allow to delete partition table if any partition is actively used.

Comment 5 Richard W.M. Jones 2012-11-20 14:53:18 UTC
Continued on list at:
http://article.gmane.org/gmane.linux.utilities.util-linux-ng/6806

Since the --force patch has been added to wipefs and it
appears to work, I'm closing the bug as fixed, but would
appreciate it if the patch could be added to F18 also
to make the virt-format tool work.

Comment 6 Karel Zak 2012-11-22 10:40:25 UTC
Fixed by upstream commit 2968c3fc7388f88b8debe64d61d9785601c16436.


Note You need to log in before you can comment on or make changes to this bug.