From edb91e14b08cebb04a53655b54e2fbc41be4ab74 Mon Sep 17 00:00:00 2001 From: Benjamin Marzinski Date: Fri, 10 Jan 2014 04:50:06 -0600 Subject: device-mapper-multipath-0.4.9-61 Add 0072-RHBZ-1039199-check-loop-control.patch * Make kpartx use LOOP_CTL_GET_FREE and loop-control to find a free loop device. This will autoload the loop module. --- 0072-RHBZ-1039199-check-loop-control.patch | 45 ++++++++++++++++++++++++++++++ device-mapper-multipath.spec | 9 +++++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 0072-RHBZ-1039199-check-loop-control.patch diff --git a/0072-RHBZ-1039199-check-loop-control.patch b/0072-RHBZ-1039199-check-loop-control.patch new file mode 100644 index 0000000..73d6f88 --- /dev/null +++ b/0072-RHBZ-1039199-check-loop-control.patch @@ -0,0 +1,45 @@ +--- + kpartx/lopart.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +Index: multipath-tools-130222/kpartx/lopart.c +=================================================================== +--- multipath-tools-130222.orig/kpartx/lopart.c ++++ multipath-tools-130222/kpartx/lopart.c +@@ -32,6 +32,10 @@ + #include "lopart.h" + #include "xstrncpy.h" + ++#ifndef LOOP_CTL_GET_FREE ++#define LOOP_CTL_GET_FREE 0x4C82 ++#endif ++ + #if !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) \ + && !defined (__s390x__) + #define int2ptr(x) ((void *) ((int) x)) +@@ -140,14 +144,23 @@ find_unused_loop_device (void) + + char dev[20]; + char *loop_formats[] = { "/dev/loop%d", "/dev/loop/%d" }; +- int i, j, fd, somedev = 0, someloop = 0, loop_known = 0; ++ int i, j, fd, first = 0, somedev = 0, someloop = 0, loop_known = 0; + struct stat statbuf; + struct loop_info loopinfo; + FILE *procdev; + ++ if (stat("/dev/loop-control", &statbuf) == 0 && ++ S_ISCHR(statbuf.st_mode)) { ++ fd = open("/dev/loop-control", O_RDWR); ++ if (fd >= 0) ++ first = ioctl(fd, LOOP_CTL_GET_FREE); ++ close(fd); ++ if (first < 0) ++ first = 0; ++ } + for (j = 0; j < SIZE(loop_formats); j++) { + +- for(i = 0; i < 256; i++) { ++ for(i = first; i < 256; i++) { + sprintf(dev, loop_formats[j], i); + + if (stat (dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) { diff --git a/device-mapper-multipath.spec b/device-mapper-multipath.spec index 6243efe..2625c97 100644 --- a/device-mapper-multipath.spec +++ b/device-mapper-multipath.spec @@ -1,7 +1,7 @@ Summary: Tools to manage multipath devices using device-mapper Name: device-mapper-multipath Version: 0.4.9 -Release: 60%{?dist} +Release: 61%{?dist} License: GPL+ Group: System Environment/Base URL: http://christophe.varoqui.free.fr/ @@ -79,6 +79,7 @@ Patch0068: 0068-RHBZ-1034578-label-partition-devices.patch Patch0069: 0069-UPBZ-1033791-improve-rdac-checker.patch Patch0070: 0070-RHBZ-1036503-blacklist-td-devs.patch Patch0071: 0071-RHBZ-1031546-strip-dev.patch +Patch0072: 0072-RHBZ-1039199-check-loop-control.patch # runtime Requires: %{name}-libs = %{version}-%{release} @@ -202,6 +203,7 @@ kpartx manages partition creation and removal for device-mapper devices. %patch0069 -p1 %patch0070 -p1 %patch0071 -p1 +%patch0072 -p1 cp %{SOURCE1} . %build @@ -295,6 +297,11 @@ bin/systemctl --no-reload enable multipathd.service >/dev/null 2>&1 ||: %{_mandir}/man8/kpartx.8.gz %changelog +* Tue Dec 10 2013 Benjamin Marzinski 0.4.9-61 +- Add 0072-RHBZ-1039199-check-loop-control.patch + * Make kpartx use LOOP_CTL_GET_FREE and loop-control to find a free + loop device. This will autoload the loop module. + * Mon Dec 9 2013 Benjamin Marzinski 0.4.9-60 - Add 0067-RHBZ-1022899-fix-udev-partition-handling.patch * Make sure to wipe partition devices on change event if they weren't -- cgit