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.
This commit is contained in:
Benjamin Marzinski 2014-01-10 04:50:06 -06:00
parent f5f1bbe03e
commit edb91e14b0
2 changed files with 53 additions and 1 deletions

View File

@ -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)) {

View File

@ -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 <bmarzins@redhat.com> 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 <bmarzins@redhat.com> 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