Util-Linux package development
 help / color / mirror / Atom feed
From: Unknown <ben.kero@gmail.com>
To: util-linux@vger.kernel.org
Subject: sfdisk: failure to write partition layout to loopback devices
Date: Thu, 16 Apr 2015 04:06:31 -0700	[thread overview]
Message-ID: <1429182391.15041.2.camel@gmail.com> (raw)

In util-linux 2.26 and onward a check is done to see if there are any
open filehandles on the device that is being updated. Specifically,
this check is being done in 'is_device_used': disk-utils/sfdisk.c:1055

For loopback devices the ioctl(fd, BLKRRPART) will always fail with
return code -1. Checking errno will yield error '22'. This is
"expected" and parted has considered making exceptions for this in the
past [1]. I would propose that instead of having to iss ue a '--force'
flag for basic loopback device operation, an exception should be
included in the is_device_used function.

It could be as simple as:

+    // If we are dealing with a loopback device this will fail, but
shouldn't
+    if (!strncmp("/dev/loop", fdisk_get_devname(sf->cxt), 9)) {
+        return 0;
+    }


[1] http://comments.gmane.org/gmane.comp.gnu.parted.devel/2254

             reply	other threads:[~2015-04-16 11:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-16 11:06 Unknown [this message]
2015-04-17  8:36 ` sfdisk: failure to write partition layout to loopback devices Karel Zak

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=1429182391.15041.2.camel@gmail.com \
    --to=ben.kero@gmail.com \
    --cc=util-linux@vger.kernel.org \
    /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