Bug 872831 - wipefs error: /dev/sda: probing initialization failed: Device or resource busy
wipefs error: /dev/sda: probing initialization failed: Device or resource busy
Status: CLOSED CURRENTRELEASE
Product: Fedora
Classification: Fedora
Component: util-linux (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Karel Zak
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-03 13:14 EDT by Richard W.M. Jones
Modified: 2013-04-10 10:38 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-03 09:24:56 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2012-11-03 13:14:18 EDT
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 14:29:55 EDT
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 10:42:26 EST
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 10:45:43 EST
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 08:47:41 EST
(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 09:53:18 EST
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 05:40:25 EST
Fixed by upstream commit 2968c3fc7388f88b8debe64d61d9785601c16436.

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