Util-Linux package development
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Unknown <ben.kero@gmail.com>
Cc: util-linux@vger.kernel.org
Subject: Re: sfdisk: failure to write partition layout to loopback devices
Date: Fri, 17 Apr 2015 10:36:38 +0200	[thread overview]
Message-ID: <20150417083638.GF6757@ws.net.home> (raw)
In-Reply-To: <1429182391.15041.2.camel@gmail.com>

On Thu, Apr 16, 2015 at 04:06:31AM -0700, Unknown wrote:
> 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;
> +    }

 Fixed (I have use major(st.st_rdev) == LOOPDEV_MAJOR).

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

      reply	other threads:[~2015-04-17  8:36 UTC|newest]

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

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=20150417083638.GF6757@ws.net.home \
    --to=kzak@redhat.com \
    --cc=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