import CS udisks2-2.9.4-11.el9

This commit is contained in:
eabdullin 2024-09-30 16:44:46 +00:00
parent 27c962bed6
commit 2a85bf7a08
4 changed files with 257 additions and 1 deletions

View File

@ -0,0 +1,30 @@
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);
}

View File

@ -0,0 +1,176 @@
diff -up udisks-2.9.4/modules/lvm2/udiskslvm2daemonutil.c.bak udisks-2.9.4/modules/lvm2/udiskslvm2daemonutil.c
--- udisks-2.9.4/modules/lvm2/udiskslvm2daemonutil.c.bak 2021-09-29 18:00:31.000000000 +0200
+++ udisks-2.9.4/modules/lvm2/udiskslvm2daemonutil.c 2024-05-15 14:51:50.641652449 +0200
@@ -35,6 +35,7 @@
#include <sys/ioctl.h>
#include <linux/fs.h>
+#include <blockdev/fs.h>
#include <blockdev/lvm.h>
#include <limits.h>
@@ -79,63 +80,6 @@ udisks_daemon_util_lvm2_block_is_unused
return TRUE;
}
-static gboolean
-run_sync (const gchar *prog, ...)
-{
- va_list ap;
- GError **error;
- enum { max_argc = 20 };
- const gchar *argv[max_argc+1];
- int argc = 0;
- const gchar *arg;
- gchar *standard_output;
- gchar *standard_error;
- gint exit_status;
-
- argv[argc++] = prog;
- va_start (ap, prog);
- while ((arg = va_arg (ap, const gchar *)))
- {
- if (argc < max_argc)
- argv[argc] = arg;
- argc++;
- }
- error = va_arg (ap, GError **);
- va_end (ap);
-
- if (argc > max_argc)
- {
- g_set_error (error, UDISKS_ERROR, UDISKS_ERROR_FAILED,
- "Too many arguments.");
- return FALSE;
- }
-
- argv[argc] = NULL;
- if (!g_spawn_sync (NULL,
- (gchar **)argv,
- NULL,
- G_SPAWN_SEARCH_PATH,
- NULL,
- NULL,
- &standard_output,
- &standard_error,
- &exit_status,
- error))
- return FALSE;
-
- if (!g_spawn_check_exit_status (exit_status, error))
- {
- g_prefix_error (error, "stdout: '%s', stderr: '%s', ", standard_output, standard_error);
- g_free (standard_output);
- g_free (standard_error);
- return FALSE;
- }
-
- g_free (standard_output);
- g_free (standard_error);
- return TRUE;
-}
-
gboolean
udisks_daemon_util_lvm2_wipe_block (UDisksDaemon *daemon,
UDisksBlock *block,
@@ -148,18 +92,19 @@ udisks_daemon_util_lvm2_wipe_block (UDis
UDisksVolumeGroup *volume_group;
gchar *volume_group_name = NULL;
gboolean was_partitioned;
-
const gchar *device_file;
- int fd = -1;
- gchar zeroes[512];
gboolean ret = TRUE;
GError *local_error = NULL;
/* Find the name of the volume group that this device is a physical
* member of, if any. Easy.
*/
-
- block_object = UDISKS_OBJECT (g_dbus_interface_get_object (G_DBUS_INTERFACE (block)));
+ block_object = udisks_daemon_util_dup_object (block, error);
+ if (block_object == NULL)
+ {
+ ret = FALSE;
+ goto out;
+ }
physical_volume = udisks_object_peek_physical_volume (block_object);
if (physical_volume)
{
@@ -177,48 +122,22 @@ udisks_daemon_util_lvm2_wipe_block (UDis
device_file = udisks_block_get_device (block);
- /* Remove partition table */
- memset (zeroes, 0, 512);
- fd = open (device_file, O_RDWR | O_EXCL);
- if (fd < 0)
+ if (!bd_fs_clean (device_file, &local_error))
{
g_set_error (error, UDISKS_ERROR, UDISKS_ERROR_FAILED,
- "Error opening device %s for wiping: %m",
- device_file);
- ret = FALSE;
- goto out;
- }
-
- if (write (fd, zeroes, 512) != 512)
- {
- g_set_error (error, UDISKS_ERROR, UDISKS_ERROR_FAILED,
- "Error erasing device %s: %m",
- device_file);
- ret = FALSE;
- goto out;
- }
-
- if (was_partitioned && ioctl (fd, BLKRRPART, NULL) < 0)
- {
- g_set_error (error, UDISKS_ERROR, UDISKS_ERROR_FAILED,
- "Error removing partition devices of %s: %m",
- device_file);
+ "%s", local_error->message);
+ g_clear_error (&local_error);
ret = FALSE;
goto out;
}
- close (fd);
- fd = -1;
- /* wipe other labels */
- if (!run_sync ("wipefs", "-a", device_file, NULL, error))
- {
- ret = FALSE;
- goto out;
- }
+ if (was_partitioned)
+ udisks_linux_block_object_reread_partition_table (UDISKS_LINUX_BLOCK_OBJECT (block_object));
/* Try to bring affected volume group back into consistency. */
- if (volume_group_name != NULL)
- if (!bd_lvm_vgreduce (volume_group_name, NULL /* device */, NULL /* extra */, &local_error)) {
+ if (volume_group_name != NULL &&
+ !bd_lvm_vgreduce (volume_group_name, NULL /* device */, NULL /* extra */, &local_error))
+ {
udisks_warning ("%s", local_error->message);
g_clear_error (&local_error);
}
@@ -230,16 +149,15 @@ udisks_daemon_util_lvm2_wipe_block (UDis
*
* https://bugzilla.redhat.com/show_bug.cgi?id=1063813
*/
- if (!run_sync ("pvscan", "--cache", device_file, NULL, &local_error))
+ if (!bd_lvm_pvscan (device_file, TRUE, NULL, &local_error))
{
udisks_warning ("%s", local_error->message);
g_clear_error (&local_error);
}
out:
- if (fd >= 0)
- close (fd);
g_clear_object (&volume_group_object);
+ g_clear_object (&block_object);
g_free (volume_group_name);
return ret;
}

View File

@ -0,0 +1,38 @@
From acae6bf4594f80da57855343ab325f87386178c4 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Fri, 3 Nov 2023 16:40:54 +0100
Subject: [PATCH] tests: Fix targetcli_config.json
Not all attributes are available anymore in newer kernel versions.
---
src/tests/dbus-tests/targetcli_config.json | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/tests/dbus-tests/targetcli_config.json b/src/tests/dbus-tests/targetcli_config.json
index 3be9eac2be..f50bf7d4d2 100644
--- a/src/tests/dbus-tests/targetcli_config.json
+++ b/src/tests/dbus-tests/targetcli_config.json
@@ -331,7 +331,6 @@
"demo_mode_write_protect": 0,
"generate_node_acls": 1,
"login_timeout": 15,
- "netif_timeout": 2,
"prod_mode_write_protect": 0,
"t10_pi": 0,
"tpg_enabled_sendtargets": 1
@@ -393,7 +392,6 @@
"demo_mode_write_protect": 1,
"generate_node_acls": 0,
"login_timeout": 15,
- "netif_timeout": 2,
"prod_mode_write_protect": 0,
"t10_pi": 0,
"tpg_enabled_sendtargets": 1
@@ -479,7 +477,6 @@
"demo_mode_write_protect": 1,
"generate_node_acls": 0,
"login_timeout": 15,
- "netif_timeout": 2,
"prod_mode_write_protect": 0,
"t10_pi": 0,
"tpg_enabled_sendtargets": 1

View File

@ -48,7 +48,7 @@
Name: udisks2
Summary: Disk Manager
Version: 2.9.4
Release: 9%{?dist}
Release: 11%{?dist}
License: GPLv2+
URL: https://github.com/storaged-project/udisks
Source0: https://github.com/storaged-project/udisks/releases/download/udisks-%{version}/udisks-%{version}.tar.bz2
@ -85,6 +85,11 @@ Patch19: udisks-2.10.0-lvm2_vgcreate_uevent_sync.patch
Patch20: udisks-2.9.4-tests_job_unstable.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=2213769
Patch21: udisks-2.10.0-iscsi-ibft-chap-auth.patch
# https://issues.redhat.com/browse/RHEL-16229
Patch22: udisks-2.11.0-targetcli_config_attr_fix.patch
# https://issues.redhat.com/browse/RHEL-8031
Patch23: udisks-2.11.0-lvm2_refactor_wipe.patch
Patch24: udisks-2.11.0-BLKRRPART-harder.patch
BuildRequires: make
BuildRequires: glib2-devel >= %{glib2_version}
@ -460,6 +465,13 @@ fi
%endif
%changelog
* 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()
* Tue Nov 28 2023 Tomas Bzatek <tbzatek@redhat.com> - 2.9.4-10
- tests: Fix targetcli_config.json (RHEL-16229)
* Wed Aug 02 2023 Tomas Bzatek <tbzatek@redhat.com> - 2.9.4-9
- iscsi: Fix login on firmware-discovered nodes (#2213769)