udisks2/udisks-2.11.0-BLKRRPART-harder.patch
Tomas Bzatek a49c9510f6 * Wed May 15 2024 Tomas Bzatek <tbzatek@redhat.com> - 2.9.4-11
- udiskslinuxblockobject: Try issuing BLKRRPART ioctl harder
- lvm2: Refactor udisks_daemon_util_lvm2_wipe_block()

Resolves: RHEL-8031
2024-05-15 14:52:59 +02:00

31 lines
1.1 KiB
Diff

diff -up udisks-2.9.4/src/udiskslinuxblockobject.c.bak udisks-2.9.4/src/udiskslinuxblockobject.c
--- udisks-2.9.4/src/udiskslinuxblockobject.c.bak 2021-09-29 18:00:31.000000000 +0200
+++ udisks-2.9.4/src/udiskslinuxblockobject.c 2024-05-15 14:29:38.637194092 +0200
@@ -1059,16 +1059,24 @@ udisks_linux_block_object_reread_partiti
/* acquire an exclusive BSD lock to prevent udev probes.
* See also https://systemd.io/BLOCK_DEVICE_LOCKING
*/
+ num_tries = 10;
while (flock (fd, LOCK_EX | LOCK_NB) != 0)
{
g_usleep (100 * 1000); /* microseconds */
- if (num_tries++ > 5)
+ if (num_tries-- < 0)
break;
}
- if (ioctl (fd, BLKRRPART) != 0)
+ num_tries = 5;
+ while (ioctl (fd, BLKRRPART) != 0)
{
+ if (errno == EBUSY && num_tries-- >= 0)
+ {
+ g_usleep (200 * 1000); /* microseconds */
+ continue;
+ }
udisks_warning ("Error issuing BLKRRPART to %s: %m", device_file);
+ break;
}
close (fd);
}