Re: sfdisk: failure to write partition layout to loopback devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux