* sfdisk: failure to write partition layout to loopback devices
@ 2015-04-16 11:06 Unknown
2015-04-17 8:36 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Unknown @ 2015-04-16 11:06 UTC (permalink / raw)
To: util-linux
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: sfdisk: failure to write partition layout to loopback devices
2015-04-16 11:06 sfdisk: failure to write partition layout to loopback devices Unknown
@ 2015-04-17 8:36 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2015-04-17 8:36 UTC (permalink / raw)
To: Unknown; +Cc: util-linux
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-17 8:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-16 11:06 sfdisk: failure to write partition layout to loopback devices Unknown
2015-04-17 8:36 ` Karel Zak
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.