device-mapper-multipath/0029-RH-kpartx-retry.patch
Benjamin Marzinski 775d7c1eb9 device-mapper-multipath-0.4.9-38
Add 0026-RH-fix-mpathpersist-fns.patch
Add 0027-RH-default-partition-delimiters.patch
  * Only use the -p delimiter when the device name ends in a number
Add 0028-RH-storagetek-config.patch
Add 0029-RH-kpartx-retry.patch
  * retry delete on busy loop devices
Add 0030-RH-early-blacklist.patch
  * multipath will now blacklist devices by device type and wwid in
    store_pathinfo, so that it doesn't do a bunch of unnecessary work
    on paths that it would only be removing later on.
2012-11-30 08:55:32 -06:00

35 lines
850 B
Diff

Index: multipath-tools-120821/kpartx/lopart.c
===================================================================
--- multipath-tools-120821.orig/kpartx/lopart.c
+++ multipath-tools-120821/kpartx/lopart.c
@@ -286,6 +286,7 @@ set_loop (const char *device, const char
extern int
del_loop (const char *device)
{
+ int retries = 3;
int fd;
if ((fd = open (device, O_RDONLY)) < 0) {
@@ -295,10 +296,17 @@ del_loop (const char *device)
return 1;
}
- if (ioctl (fd, LOOP_CLR_FD, 0) < 0) {
- perror ("ioctl: LOOP_CLR_FD");
- close (fd);
- return 1;
+ while (ioctl (fd, LOOP_CLR_FD, 0) < 0) {
+ if (errno != EBUSY || retries-- <= 0) {
+ perror ("ioctl: LOOP_CLR_FD");
+ close (fd);
+ return 1;
+ }
+ fprintf(stderr,
+ "loop: device %s still in use, retrying delete\n",
+ device);
+ sleep(1);
+ continue;
}
close (fd);