From 980768975f50ad393238577a1e1d33409230f6f9 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 10 2018 05:36:34 +0000 Subject: import udisks2-2.7.3-6.el7 --- diff --git a/.gitignore b/.gitignore index dbf74be..89bc8dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/udisks-2.1.2.tar.bz2 +SOURCES/udisks-2.7.3.tar.bz2 diff --git a/.udisks2.metadata b/.udisks2.metadata index f16e80d..c81af9b 100644 --- a/.udisks2.metadata +++ b/.udisks2.metadata @@ -1 +1 @@ -093dc9a32752b63819e5d6856a8b0e3ba6d6d902 SOURCES/udisks-2.1.2.tar.bz2 +dd8daa649796a6737ef3f0fd3fe3f536714b9fba SOURCES/udisks-2.7.3.tar.bz2 diff --git a/SOURCES/fix_mpoin_cleanup_1384796.patch b/SOURCES/fix_mpoin_cleanup_1384796.patch new file mode 100644 index 0000000..2c6499e --- /dev/null +++ b/SOURCES/fix_mpoin_cleanup_1384796.patch @@ -0,0 +1,93 @@ +From aad98b87513f9e277258c8bc9c3bc7db7a8442ba Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Thu, 18 Jan 2018 13:59:11 +0100 +Subject: [PATCH] Fix escaping mountpoint for the cleanup service + +We need to use the 'systemd-escape' command -- it escapes more +symbols and manually escaping only slashes isn't enough. + +Resolves: rhbz#1384796 +(cherry picked from commit 4d982bb6b81afcd17b0a42b6c1256c22ff444ee5) +--- + src/udiskslinuxfilesystem.c | 38 +++++++++++++++++++++++++++----------- + 1 file changed, 27 insertions(+), 11 deletions(-) + +diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c +index 2910181..e2b7e18 100644 +--- a/src/udiskslinuxfilesystem.c ++++ b/src/udiskslinuxfilesystem.c +@@ -1144,10 +1144,11 @@ is_system_managed (UDisksBlock *block, + + static void trigger_mpoint_cleanup (const gchar *mount_point) + { +- const gchar *argv[] = {"systemctl", "start", NULL, NULL}; ++ const gchar *service_argv[] = {"systemctl", "start", NULL, NULL}; ++ const gchar *escape_argv[] = {"systemd-escape", NULL, NULL}; + GError *error = NULL; + gchar *escaped_mpoint = NULL; +- gsize len = 0; ++ size_t len = 0; + + if (g_str_has_prefix (mount_point, "/")) + mount_point++; +@@ -1155,14 +1156,27 @@ static void trigger_mpoint_cleanup (const gchar *mount_point) + udisks_warning ("Invalid mount point given to trigger_mpoint_cleanup(): %s", + mount_point); + +- /* start with the mount point without the leading '/' */ +- escaped_mpoint = g_strdup (mount_point); ++ /* use 'systemd-escape' to escape the mountpoint */ ++ escape_argv[1] = g_strdup (mount_point); + +- /* and replace all '/'s with '-'s */ +- for (gchar *letter = escaped_mpoint; *letter != '\0'; letter++, len++) ++ if (!bd_utils_exec_and_capture_output (escape_argv, NULL, &escaped_mpoint, &error) && (error != NULL)) + { +- if (*letter == '/') +- *letter = '-'; ++ /* this is a best-effort mechanism, if it fails, just log warning and move ++ on */ ++ udisks_warning ("Failed to setup systemd-based mount point cleanup: %s", ++ error->message); ++ g_clear_error (&error); ++ goto out; ++ } ++ ++ /* remove leading/trailing whitespace */ ++ g_strstrip (escaped_mpoint); ++ ++ len = strlen (escaped_mpoint); ++ if (len <= 0) ++ { ++ udisks_warning ("Failed to setup systemd-based mount point cleanup"); ++ goto out; + } + + /* remove the potential trailing '-' (would happen if the given mount_point +@@ -1170,9 +1184,9 @@ static void trigger_mpoint_cleanup (const gchar *mount_point) + if (escaped_mpoint[len - 1] == '-') + escaped_mpoint[len - 1] = '\0'; + +- argv[2] = g_strdup_printf ("clean-mount-point@%s", escaped_mpoint); ++ service_argv[2] = g_strdup_printf ("clean-mount-point@%s", escaped_mpoint); + +- if (!bd_utils_exec_and_report_error (argv, NULL, &error) && (error != NULL)) ++ if (!bd_utils_exec_and_report_error (service_argv, NULL, &error) && (error != NULL)) + { + /* this is a best-effort mechanism, if it fails, just log warning and move + on */ +@@ -1181,8 +1195,10 @@ static void trigger_mpoint_cleanup (const gchar *mount_point) + g_clear_error (&error); + } + ++out: + g_free (escaped_mpoint); +- g_free ((gchar *) argv[2]); ++ g_free ((gchar *) service_argv[2]); ++ g_free ((gchar *) escape_argv[1]); + } + + /* ---------------------------------------------------------------------------------------------------- */ +-- +1.8.3.1 + diff --git a/SOURCES/fix_thinpool_size_1534904.patch b/SOURCES/fix_thinpool_size_1534904.patch new file mode 100644 index 0000000..c78320d --- /dev/null +++ b/SOURCES/fix_thinpool_size_1534904.patch @@ -0,0 +1,34 @@ +From 34bf5d61e5ea1bd9450db6197fc9791a8e7aa8da Mon Sep 17 00:00:00 2001 +From: Marius Vollmer +Date: Wed, 13 Dec 2017 15:28:23 +0200 +Subject: [PATCH] lvm2: Don't match prefixes in cmp_int_lv_name + +Once the whole internal name has matched, the other name must also be +at the end. Otherwise we might find "lvol0" when looking for +"lvol0_meta", for example. + +The symptom is that the size of a pool is reported as twice its data +size, instead of data plus metadata size, which funnily is exactly the +same symptom fixed by 043edcb. Deja vu... + +(cherry picked from commit 821bc20911e9a446b943cf40abe0e8a8132bf418) +--- + modules/lvm2/udiskslinuxvolumegroupobject.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules/lvm2/udiskslinuxvolumegroupobject.c b/modules/lvm2/udiskslinuxvolumegroupobject.c +index 617af04..3f622a6 100644 +--- a/modules/lvm2/udiskslinuxvolumegroupobject.c ++++ b/modules/lvm2/udiskslinuxvolumegroupobject.c +@@ -530,7 +530,7 @@ cmp_int_lv_name (const gchar *int_lv_name, const gchar *lv_name) + + if (*c == ']') + c++; +- if (*c == '\0') ++ if (*c == '\0' && lv_name[c - int_lv_name] == '\0') + return TRUE; + + return FALSE; +-- +1.8.3.1 + diff --git a/SOURCES/no_discard_1516697.patch b/SOURCES/no_discard_1516697.patch new file mode 100644 index 0000000..65eda10 --- /dev/null +++ b/SOURCES/no_discard_1516697.patch @@ -0,0 +1,317 @@ +From 50b7a2125f77f23901eff12c76efb80881236513 Mon Sep 17 00:00:00 2001 +From: Marius Vollmer +Date: Thu, 23 Nov 2017 11:40:50 +0200 +Subject: [PATCH] Add 'no-discard' option to formatting methods + +It unfortunately seems to be necessary to use this option in certain +situations. See https://bugzilla.redhat.com/show_bug.cgi?id=1516041 +for example. + +(cherry picked from commit 26ac7429b5ef9b5024e54e6eca25b685c0666eb5) + +Conflicts: + src/udiskslinuxblock.c + +Signed-off-by: Vratislav Podzimek +--- + data/org.freedesktop.UDisks2.xml | 4 ++++ + src/tests/integration-test | 14 +++++++----- + src/udiskslinuxblock.c | 48 ++++++++++++++++++++++++++++------------ + src/udiskslinuxfsinfo.c | 31 ++++++++++++++++++-------- + src/udiskslinuxfsinfo.h | 1 + + 5 files changed, 70 insertions(+), 28 deletions(-) + +diff --git a/data/org.freedesktop.UDisks2.xml b/data/org.freedesktop.UDisks2.xml +index fa53a72..1f71ca1 100644 +--- a/data/org.freedesktop.UDisks2.xml ++++ b/data/org.freedesktop.UDisks2.xml +@@ -1404,6 +1404,10 @@ + this allows a deeper check of the parameters even when + no-block is %TRUE. + ++ If the option no-discard is set to ++ %TRUE then Udisks tells the formatting utility not to issue ++ BLKDISCARD ioctls. ++ + If the option config-items is set, it + should be an array of configuration items suitable for + org.freedesktop.UDisks2.Block.AddConfigurationItem. They will +diff --git a/src/tests/integration-test b/src/tests/integration-test +index f863578..0edbb6a 100755 +--- a/src/tests/integration-test ++++ b/src/tests/integration-test +@@ -825,6 +825,8 @@ class FS(UDisksTestCase): + self._do_udisks_check(fs_type, 'test%stst' % fs_type) + # also test fs_create with an empty label + self._do_udisks_check(fs_type, '') ++ # also test fs_create with the no-discard option ++ self._do_udisks_check(fs_type, '', True) + + def _do_cli_check(self, fs_type, label=None): + """udisks correctly picks up file system changes from command line tools""" +@@ -890,15 +892,17 @@ class FS(UDisksTestCase): + subprocess.call(['umount', mount_a]) + self.assertProperty(fs, 'mount-points', []) + +- def _do_udisks_check(self, fs_type, label=None): ++ def _do_udisks_check(self, fs_type, label=None, no_discard=None): + """udisks API correctly changes file system""" + ++ + # create fs ++ options = { } + if label is not None: +- options = GLib.Variant('a{sv}', {'label': GLib.Variant('s', label)}) +- else: +- options = no_options +- self.fs_create(None, fs_type, options) ++ options['label'] = GLib.Variant('s', label); ++ if no_discard is not None: ++ options['no-discard'] = GLib.Variant('b', no_discard); ++ self.fs_create(None, fs_type, GLib.Variant('a{sv}', options)) + + # properties + b_id = self.blkid() +diff --git a/src/udiskslinuxblock.c b/src/udiskslinuxblock.c +index 3d56577..0de5422 100644 +--- a/src/udiskslinuxblock.c ++++ b/src/udiskslinuxblock.c +@@ -2656,6 +2656,27 @@ add_blocksize (gchar **command, + return TRUE; + } + ++static gchar * ++build_command (const gchar *template, ++ const gchar *device, ++ const gchar *label, ++ const gchar *options, ++ GError **error) ++{ ++ gchar *tmp, *tmp2, *command; ++ tmp = udisks_daemon_util_subst_str_and_escape (template, "$DEVICE", device); ++ tmp2 = udisks_daemon_util_subst_str_and_escape (tmp, "$LABEL", label != NULL ? label : ""); ++ command = udisks_daemon_util_subst_str (tmp2, "$OPTIONS", options != NULL ? options : ""); ++ g_free (tmp); ++ g_free (tmp2); ++ if (strstr (command, "$BLOCKSIZE") && ! add_blocksize (&command, device, error)) ++ { ++ g_free (command); ++ return NULL; ++ } ++ ++ return command; ++} + + void + udisks_linux_block_handle_format (UDisksBlock *block, +@@ -2679,8 +2700,8 @@ udisks_linux_block_handle_format (UDisksBlock *block, + const gchar *action_id; + const gchar *message; + const FSInfo *fs_info; ++ const gchar *command_options = NULL; + gchar *command = NULL; +- gchar *tmp; + gchar *error_message; + GError *error; + int status; +@@ -2700,6 +2721,7 @@ udisks_linux_block_handle_format (UDisksBlock *block, + const gchar *partition_type = NULL; + GVariant *config_items = NULL; + gboolean teardown_flag = FALSE; ++ gboolean no_discard_flag = FALSE; + BDPartTableType part_table_type = BD_PART_TABLE_UNDEF; + + error = NULL; +@@ -2723,6 +2745,7 @@ udisks_linux_block_handle_format (UDisksBlock *block, + g_variant_lookup (options, "dry-run-first", "b", &dry_run_first); + g_variant_lookup (options, "config-items", "@a(sa{sv})", &config_items); + g_variant_lookup (options, "tear-down", "b", &teardown_flag); ++ g_variant_lookup (options, "no-discard", "b", &no_discard_flag); + + partition = udisks_object_get_partition (object); + if (partition != NULL) +@@ -2886,21 +2909,20 @@ udisks_linux_block_handle_format (UDisksBlock *block, + goto out; + } + ++ if (no_discard_flag && fs_info->option_no_discard) ++ command_options = fs_info->option_no_discard; ++ + /* If requested, check whether the ultimate filesystem creation + will succeed before actually getting to work. + */ + if (dry_run_first && fs_info->command_validate_create_fs) + { + const gchar *device = udisks_block_get_device (block); +- tmp = udisks_daemon_util_subst_str_and_escape (fs_info->command_validate_create_fs, "$DEVICE", +- device); +- command = udisks_daemon_util_subst_str_and_escape (tmp, "$LABEL", label != NULL ? label : ""); +- g_free (tmp); +- if (strstr (command, "$BLOCKSIZE") && ! add_blocksize (&command, device, &error)) +- { +- handle_format_failure (invocation, error); +- goto out; +- } ++ command = build_command (fs_info->command_validate_create_fs, device, label, command_options, &error); ++ if (command == NULL) { ++ handle_format_failure (invocation, error); ++ goto out; ++ } + + if (!udisks_daemon_launch_spawned_job_sync (daemon, + object, +@@ -3081,10 +3103,8 @@ udisks_linux_block_handle_format (UDisksBlock *block, + { + /* Build and run mkfs shell command */ + const gchar *device = udisks_block_get_device (block_to_mkfs); +- tmp = udisks_daemon_util_subst_str_and_escape (fs_info->command_create_fs, "$DEVICE", device); +- command = udisks_daemon_util_subst_str_and_escape (tmp, "$LABEL", label != NULL ? label : ""); +- g_free (tmp); +- if (strstr (command, "$BLOCKSIZE") && ! add_blocksize (&command, device, &error)) ++ command = build_command (fs_info->command_create_fs, device, label, command_options, &error); ++ if (command == NULL) + { + handle_format_failure (invocation, error); + goto out; +diff --git a/src/udiskslinuxfsinfo.c b/src/udiskslinuxfsinfo.c +index b7834c0..1556af3 100644 +--- a/src/udiskslinuxfsinfo.c ++++ b/src/udiskslinuxfsinfo.c +@@ -70,8 +70,9 @@ const FSInfo _fs_info[] = + NULL, + TRUE, /* supports_online_label_rename */ + TRUE, /* supports_owners */ +- "mkfs.ext2 -F -L $LABEL $DEVICE", +- "mkfs.ext2 -n -F -L $LABEL $DEVICE", ++ "mkfs.ext2 -F -L $LABEL $OPTIONS $DEVICE", ++ "mkfs.ext2 -n -F -L $LABEL $OPTIONS $DEVICE", ++ "-E nodiscard", /* option_no_discard */ + }, + { + FS_EXT3, +@@ -79,8 +80,9 @@ const FSInfo _fs_info[] = + NULL, + TRUE, /* supports_online_label_rename */ + TRUE, /* supports_owners */ +- "mkfs.ext3 -F -L $LABEL $DEVICE", +- "mkfs.ext3 -n -F -L $LABEL $DEVICE", ++ "mkfs.ext3 -F -L $LABEL $OPTIONS $DEVICE", ++ "mkfs.ext3 -n -F -L $LABEL $OPTIONS $DEVICE", ++ "-E nodiscard", /* option_no_discard */ + }, + { + FS_EXT4, +@@ -88,8 +90,9 @@ const FSInfo _fs_info[] = + NULL, + TRUE, /* supports_online_label_rename */ + TRUE, /* supports_owners */ +- "mkfs.ext4 -F -L $LABEL $DEVICE", +- "mkfs.ext4 -n -F -L $LABEL $DEVICE", ++ "mkfs.ext4 -F -L $LABEL $OPTIONS $DEVICE", ++ "mkfs.ext4 -n -F -L $LABEL $OPTIONS $DEVICE", ++ "-E nodiscard", /* option_no_discard */ + }, + { + FS_VFAT, +@@ -99,6 +102,7 @@ const FSInfo _fs_info[] = + FALSE, /* supports_owners */ + "mkfs.vfat -I -n $LABEL $DEVICE", + NULL, ++ NULL, /* option_no_discard */ + }, + { + FS_NTFS, +@@ -108,6 +112,7 @@ const FSInfo _fs_info[] = + FALSE, /* supports_owners */ + "mkntfs -f -F -L $LABEL $DEVICE", + "mkntfs -n -f -F -L $LABEL $DEVICE", ++ NULL, /* option_no_discard */ + }, + { + FS_EXFAT, +@@ -117,6 +122,7 @@ const FSInfo _fs_info[] = + FALSE, /* supports_owners */ + "mkexfatfs -n $LABEL $DEVICE", + NULL, ++ NULL, /* option_no_discard */ + }, + { + FS_XFS, +@@ -124,8 +130,9 @@ const FSInfo _fs_info[] = + "xfs_admin -L -- $DEVICE", + FALSE, /* supports_online_label_rename */ + TRUE, /* supports_owners */ +- "mkfs.xfs -f -L $LABEL $DEVICE", +- "mkfs.xfs -N -f -L $LABEL $DEVICE" ++ "mkfs.xfs -f -L $LABEL $OPTIONS $DEVICE", ++ "mkfs.xfs -N -f -L $LABEL $OPTIONS $DEVICE", ++ "-K" /* option_no_discard */ + }, + { + FS_REISERFS, +@@ -135,6 +142,7 @@ const FSInfo _fs_info[] = + TRUE, /* supports_owners */ + "mkfs.reiserfs -q -l $LABEL $DEVICE", + NULL, ++ NULL, /* option_no_discard */ + }, + { + FS_NILFS2, +@@ -144,6 +152,7 @@ const FSInfo _fs_info[] = + TRUE, /* supports_owners */ + "mkfs.nilfs2 -L $LABEL $DEVICE", + NULL, ++ NULL, /* option_no_discard */ + }, + { + FS_BTRFS, +@@ -151,8 +160,9 @@ const FSInfo _fs_info[] = + NULL, + FALSE, /* supports_online_label_rename */ + TRUE, /* supports_owners */ +- "mkfs.btrfs -L $LABEL $DEVICE", ++ "mkfs.btrfs -L $LABEL $OPTIONS $DEVICE", + NULL, ++ "-K", /* option_no_discard */ + }, + { + FS_MINIX, +@@ -162,6 +172,7 @@ const FSInfo _fs_info[] = + FALSE, /* supports_owners */ + "mkfs.minix $DEVICE", + NULL, ++ NULL, + }, + { + FS_UDF, +@@ -171,6 +182,7 @@ const FSInfo _fs_info[] = + TRUE, /* supports_owners */ + "mkudffs --utf8 --media-type=hd --udfrev=0x201 --blocksize=$BLOCKSIZE --vid $LABEL --lvid $LABEL $DEVICE", + NULL, ++ NULL, + }, + { + FS_F2FS, +@@ -180,6 +192,7 @@ const FSInfo _fs_info[] = + TRUE, /* supports_owners */ + "mkfs.f2fs -l $LABEL $DEVICE", + NULL, ++ NULL, + }, + /* swap space */ + { +diff --git a/src/udiskslinuxfsinfo.h b/src/udiskslinuxfsinfo.h +index 2daec10..6a7a541 100644 +--- a/src/udiskslinuxfsinfo.h ++++ b/src/udiskslinuxfsinfo.h +@@ -35,6 +35,7 @@ typedef struct + gboolean supports_owners; + const gchar *command_create_fs; /* should have $DEVICE and $LABEL */ + const gchar *command_validate_create_fs; /* should have $DEVICE and $LABEL */ ++ const gchar *option_no_discard; + } FSInfo; + + const FSInfo *get_fs_info (const gchar *fstype); +-- +2.9.5 + diff --git a/SOURCES/raid_watchers_1400056.patch b/SOURCES/raid_watchers_1400056.patch new file mode 100644 index 0000000..544fdcd --- /dev/null +++ b/SOURCES/raid_watchers_1400056.patch @@ -0,0 +1,514 @@ +From 5bcb348b17935328a2344d811ddba9847ab3c846 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Mon, 16 Oct 2017 12:33:14 +0200 +Subject: [PATCH 1/5] Move some useful mdraid functions to a helper file + +Related: rhbz#1400056 +Signed-off-by: Vratislav Podzimek +--- + src/Makefile.am | 1 + + src/udiskslinuxmdraid.c | 83 ++------------------------------ + src/udiskslinuxmdraidhelpers.c | 104 +++++++++++++++++++++++++++++++++++++++++ + src/udiskslinuxmdraidhelpers.h | 41 ++++++++++++++++ + 4 files changed, 149 insertions(+), 80 deletions(-) + create mode 100644 src/udiskslinuxmdraidhelpers.c + create mode 100644 src/udiskslinuxmdraidhelpers.h + +diff --git a/src/Makefile.am b/src/Makefile.am +index 396ab4e..9cca8cd 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -66,6 +66,7 @@ libudisks_daemon_la_SOURCES = \ + udiskslinuxdrive.h udiskslinuxdrive.c \ + udiskslinuxdriveata.h udiskslinuxdriveata.c \ + udiskslinuxmdraidobject.h udiskslinuxmdraidobject.c \ ++ udiskslinuxmdraidhelpers.h udiskslinuxmdraidhelpers.c \ + udiskslinuxmdraid.h udiskslinuxmdraid.c \ + udiskslinuxmanager.h udiskslinuxmanager.c \ + udiskslinuxfsinfo.h udiskslinuxfsinfo.c \ +diff --git a/src/udiskslinuxmdraid.c b/src/udiskslinuxmdraid.c +index 9bf6ae9..2dcf0ff 100644 +--- a/src/udiskslinuxmdraid.c ++++ b/src/udiskslinuxmdraid.c +@@ -38,6 +38,7 @@ + #include "udiskslinuxprovider.h" + #include "udiskslinuxmdraidobject.h" + #include "udiskslinuxmdraid.h" ++#include "udiskslinuxmdraidhelpers.h" + #include "udiskslinuxblockobject.h" + #include "udisksdaemon.h" + #include "udisksstate.h" +@@ -128,68 +129,6 @@ udisks_linux_mdraid_new (void) + + /* ---------------------------------------------------------------------------------------------------- */ + +-static gchar * +-read_sysfs_attr (GUdevDevice *device, +- const gchar *attr) +-{ +- gchar *ret = NULL; +- gchar *path = NULL; +- GError *error = NULL; +- +- g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); +- +- path = g_strdup_printf ("%s/%s", g_udev_device_get_sysfs_path (device), attr); +- if (!g_file_get_contents (path, &ret, NULL /* size */, &error)) +- { +- udisks_warning ("Error reading sysfs attr `%s': %s (%s, %d)", +- path, error->message, g_quark_to_string (error->domain), error->code); +- g_clear_error (&error); +- goto out; +- } +- +- out: +- g_free (path); +- return ret; +-} +- +-static gint +-read_sysfs_attr_as_int (GUdevDevice *device, +- const gchar *attr) +-{ +- gint ret = 0; +- gchar *str = NULL; +- +- str = read_sysfs_attr (device, attr); +- if (str == NULL) +- goto out; +- +- ret = atoi (str); +- g_free (str); +- +- out: +- return ret; +-} +- +-static guint64 +-read_sysfs_attr_as_uint64 (GUdevDevice *device, +- const gchar *attr) +-{ +- guint64 ret = 0; +- gchar *str = NULL; +- +- str = read_sysfs_attr (device, attr); +- if (str == NULL) +- goto out; +- +- ret = atoll (str); +- g_free (str); +- +- out: +- return ret; +-} +- +-/* ---------------------------------------------------------------------------------------------------- */ +- + static gboolean + on_polling_timout (gpointer user_data) + { +@@ -306,8 +245,6 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, + guint64 sync_remaining_time = 0; + GVariantBuilder builder; + UDisksDaemon *daemon = NULL; +- gboolean has_redundancy = FALSE; +- gboolean has_stripes = FALSE; + UDisksBaseJob *job = NULL; + + daemon = udisks_linux_mdraid_object_get_daemon (object); +@@ -377,23 +314,9 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, + + udisks_mdraid_set_running (iface, raid_device != NULL); + +- if (g_strcmp0 (level, "raid1") == 0 || +- g_strcmp0 (level, "raid4") == 0 || +- g_strcmp0 (level, "raid5") == 0 || +- g_strcmp0 (level, "raid6") == 0 || +- g_strcmp0 (level, "raid10") == 0) +- has_redundancy = TRUE; +- +- if (g_strcmp0 (level, "raid0") == 0 || +- g_strcmp0 (level, "raid4") == 0 || +- g_strcmp0 (level, "raid5") == 0 || +- g_strcmp0 (level, "raid6") == 0 || +- g_strcmp0 (level, "raid10") == 0) +- has_stripes = TRUE; +- + if (raid_device != NULL) + { +- if (has_redundancy) ++ if (mdraid_has_redundancy (level)) + { + /* Can't use GUdevDevice methods as they cache the result and these variables vary */ + degraded = read_sysfs_attr_as_int (raid_device->udev_device, "md/degraded"); +@@ -408,7 +331,7 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, + g_strstrip (bitmap_location); + } + +- if (has_stripes) ++ if (mdraid_has_stripes (level)) + { + chunk_size = read_sysfs_attr_as_uint64 (raid_device->udev_device, "md/chunk_size"); + } +diff --git a/src/udiskslinuxmdraidhelpers.c b/src/udiskslinuxmdraidhelpers.c +new file mode 100644 +index 0000000..dafdddf +--- /dev/null ++++ b/src/udiskslinuxmdraidhelpers.c +@@ -0,0 +1,104 @@ ++/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- ++ * ++ * Copyright (C) 2017 Red Hat, Inc. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ * Author: Vojtech Trefny ++ * ++ */ ++ ++#include ++#include ++#include ++ ++#include "udiskslinuxmdraidhelpers.h" ++#include "udiskslogging.h" ++ ++gboolean ++mdraid_has_redundancy (const gchar *raid_level) ++{ ++ return raid_level != NULL && ++ g_str_has_prefix (raid_level, "raid") && ++ g_strcmp0 (raid_level, "raid0") != 0; ++} ++ ++gboolean ++mdraid_has_stripes (const gchar *raid_level) ++{ ++ return raid_level != NULL && ++ g_str_has_prefix (raid_level, "raid") && ++ g_strcmp0 (raid_level, "raid1") != 0; ++} ++ ++gchar * ++read_sysfs_attr (GUdevDevice *device, ++ const gchar *attr) ++{ ++ gchar *ret = NULL; ++ gchar *path = NULL; ++ GError *error = NULL; ++ ++ g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); ++ ++ path = g_strdup_printf ("%s/%s", g_udev_device_get_sysfs_path (device), attr); ++ if (!g_file_get_contents (path, &ret, NULL /* size */, &error)) ++ { ++ udisks_warning ("Error reading sysfs attr `%s': %s (%s, %d)", ++ path, error->message, g_quark_to_string (error->domain), error->code); ++ g_clear_error (&error); ++ goto out; ++ } ++ ++ out: ++ g_free (path); ++ return ret; ++} ++ ++gint ++read_sysfs_attr_as_int (GUdevDevice *device, ++ const gchar *attr) ++{ ++ gint ret = 0; ++ gchar *str = NULL; ++ ++ str = read_sysfs_attr (device, attr); ++ if (str == NULL) ++ goto out; ++ ++ ret = atoi (str); ++ g_free (str); ++ ++ out: ++ return ret; ++} ++ ++guint64 ++read_sysfs_attr_as_uint64 (GUdevDevice *device, ++ const gchar *attr) ++{ ++ guint64 ret = 0; ++ gchar *str = NULL; ++ ++ str = read_sysfs_attr (device, attr); ++ if (str == NULL) ++ goto out; ++ ++ ret = atoll (str); ++ g_free (str); ++ ++ out: ++ return ret; ++} +diff --git a/src/udiskslinuxmdraidhelpers.h b/src/udiskslinuxmdraidhelpers.h +new file mode 100644 +index 0000000..6d2b714 +--- /dev/null ++++ b/src/udiskslinuxmdraidhelpers.h +@@ -0,0 +1,41 @@ ++/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- ++ * ++ * Copyright (C) 2017 Red Hat, Inc. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ++ * ++ * Author: Vojtech Trefny ++ * ++ */ ++ ++#ifndef __UDISKS_LINUX_MDRAID_HELPERS_H__ ++#define __UDISKS_LINUX_MDRAID_HEPLERS_H__ ++ ++#include ++#include ++ ++ ++G_BEGIN_DECLS ++ ++gboolean mdraid_has_redundancy (const gchar *raid_level); ++gboolean mdraid_has_stripes (const gchar *raid_level); ++gchar *read_sysfs_attr (GUdevDevice *device, const gchar *attr); ++gint read_sysfs_attr_as_int (GUdevDevice *device, const gchar *attr); ++guint64 read_sysfs_attr_as_uint64 (GUdevDevice *device, const gchar *attr); ++ ++G_END_DECLS ++ ++ ++#endif /* __UDISKS_LINUX_MDRAID_HEPLERS_H__ */ +-- +2.9.5 + +From 61ff342139f21663958bcc2972a3efa37cf7bc83 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Mon, 16 Oct 2017 12:41:22 +0200 +Subject: [PATCH 2/5] Remove leading/trailing white space in 'read_sysfs_attr' + +So we don't have to call 'g_strstrip' after using it. + +Related: rhbz#1400056 +Signed-off-by: Vratislav Podzimek +--- + src/udiskslinuxmdraid.c | 8 -------- + src/udiskslinuxmdraidhelpers.c | 4 ++++ + 2 files changed, 4 insertions(+), 8 deletions(-) + +diff --git a/src/udiskslinuxmdraid.c b/src/udiskslinuxmdraid.c +index 2dcf0ff..22b4ee4 100644 +--- a/src/udiskslinuxmdraid.c ++++ b/src/udiskslinuxmdraid.c +@@ -321,14 +321,8 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, + /* Can't use GUdevDevice methods as they cache the result and these variables vary */ + degraded = read_sysfs_attr_as_int (raid_device->udev_device, "md/degraded"); + sync_action = read_sysfs_attr (raid_device->udev_device, "md/sync_action"); +- if (sync_action != NULL) +- g_strstrip (sync_action); + sync_completed = read_sysfs_attr (raid_device->udev_device, "md/sync_completed"); +- if (sync_completed != NULL) +- g_strstrip (sync_completed); + bitmap_location = read_sysfs_attr (raid_device->udev_device, "md/bitmap/location"); +- if (bitmap_location != NULL) +- g_strstrip (bitmap_location); + } + + if (mdraid_has_stripes (level)) +@@ -472,7 +466,6 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, + member_state = read_sysfs_attr (raid_device->udev_device, buf); + if (member_state != NULL) + { +- g_strstrip (member_state); + member_state_elements = g_strsplit (member_state, ",", 0); + } + else +@@ -486,7 +479,6 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, + member_slot = read_sysfs_attr (raid_device->udev_device, buf); + if (member_slot != NULL) + { +- g_strstrip (member_slot); + if (g_strcmp0 (member_slot, "none") != 0) + member_slot_as_int = atoi (member_slot); + } +diff --git a/src/udiskslinuxmdraidhelpers.c b/src/udiskslinuxmdraidhelpers.c +index dafdddf..297b1fa 100644 +--- a/src/udiskslinuxmdraidhelpers.c ++++ b/src/udiskslinuxmdraidhelpers.c +@@ -62,6 +62,10 @@ read_sysfs_attr (GUdevDevice *device, + goto out; + } + ++ /* remove newline from the attribute */ ++ if (ret != NULL) ++ g_strstrip (ret); ++ + out: + g_free (path); + return ret; +-- +2.9.5 + +From 756571efc1b0d602bca2dd4ff761dca686dc08bd Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Mon, 16 Oct 2017 12:42:42 +0200 +Subject: [PATCH 3/5] Do not try to create file watchers for RAIDs without + redundancy + +We are trying to watch 'md/degraded' and 'md/sync_action' sysfs +files for all RAIDs but these files exist only for RAIDs with +redundancy -- we shouldn't do this for raid0, containers and linear +RAIDs. + +Resolves: rhbz#1400056 +Signed-off-by: Vratislav Podzimek +--- + src/udiskslinuxmdraidobject.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/src/udiskslinuxmdraidobject.c b/src/udiskslinuxmdraidobject.c +index 493145e..1d2f07a 100644 +--- a/src/udiskslinuxmdraidobject.c ++++ b/src/udiskslinuxmdraidobject.c +@@ -30,6 +30,7 @@ + #include "udisksdaemonutil.h" + #include "udiskslinuxprovider.h" + #include "udiskslinuxmdraidobject.h" ++#include "udiskslinuxmdraidhelpers.h" + #include "udiskslinuxmdraid.h" + #include "udiskslinuxblockobject.h" + #include "udiskslinuxdevice.h" +@@ -552,9 +553,18 @@ static void + raid_device_added (UDisksLinuxMDRaidObject *object, + UDisksLinuxDevice *device) + { ++ gchar *level = NULL; ++ + g_assert (object->sync_action_source == NULL); + g_assert (object->degraded_source == NULL); + ++ if (!UDISKS_IS_LINUX_DEVICE (device)) ++ goto out; ++ ++ level = read_sysfs_attr (device->udev_device, "md/level"); ++ if (level == NULL || !mdraid_has_redundancy (level)) ++ goto out; ++ + /* udisks_debug ("start watching %s", g_udev_device_get_sysfs_path (device->udev_device)); */ + object->sync_action_source = watch_attr (device, + "md/sync_action", +@@ -564,6 +574,9 @@ raid_device_added (UDisksLinuxMDRaidObject *object, + "md/degraded", + (GSourceFunc) attr_changed, + object); ++ ++ out: ++ g_free (level); + } + + static void +@@ -684,6 +697,12 @@ udisks_linux_mdraid_object_uevent (UDisksLinuxMDRaidObject *object, + object->raid_device = g_object_ref (device); + raid_device_added (object, object->raid_device); + } ++ else if (object->sync_action_source == NULL && object->degraded_source == NULL) ++ { ++ /* we don't have file watchers, adding them may failed because ++ we were unable to get raid level, let's try again */ ++ raid_device_added (object, object->raid_device); ++ } + } + } + } +-- +2.9.5 + +From ab6ee79abac6a75eddd0ecfba7fc5111663bc50f Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Mon, 16 Oct 2017 15:26:16 +0200 +Subject: [PATCH 5/5] Try to use libblockdev to get RAID array size + +If reading size from sysfs fails, try to use libblockdev to read +it from mdadm --examine data. + +Signed-off-by: Vratislav Podzimek +--- + src/udiskslinuxmdraid.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/src/udiskslinuxmdraid.c b/src/udiskslinuxmdraid.c +index 22b4ee4..6c94a2b 100644 +--- a/src/udiskslinuxmdraid.c ++++ b/src/udiskslinuxmdraid.c +@@ -246,6 +246,8 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, + GVariantBuilder builder; + UDisksDaemon *daemon = NULL; + UDisksBaseJob *job = NULL; ++ GError *error = NULL; ++ BDMDExamineData *raid_data = NULL; + + daemon = udisks_linux_mdraid_object_get_daemon (object); + +@@ -303,7 +305,15 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, + } + else + { +- /* TODO: need MD_ARRAY_SIZE, see https://bugs.freedesktop.org/show_bug.cgi?id=53239#c5 */ ++ raid_data = bd_md_examine (g_udev_device_get_device_file (device->udev_device), ++ &error); ++ if (raid_data == NULL) ++ { ++ udisks_debug ("Failed to read array size: %s", error->message); ++ g_clear_error (&error); ++ } ++ else ++ size = raid_data->size; + } + + udisks_mdraid_set_uuid (iface, uuid); +@@ -523,11 +533,14 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, + uuid)); + + out: ++ if (raid_data) ++ bd_md_examine_data_free (raid_data); + g_free (sync_completed); + g_free (sync_action); + g_free (bitmap_location); + g_list_free_full (member_devices, g_object_unref); + g_clear_object (&raid_device); ++ g_clear_error (&error); + return ret; + } + +-- +2.9.5 + diff --git a/SOURCES/reboot_mpoint_cleanup_1384796.patch b/SOURCES/reboot_mpoint_cleanup_1384796.patch new file mode 100644 index 0000000..2b68e95 --- /dev/null +++ b/SOURCES/reboot_mpoint_cleanup_1384796.patch @@ -0,0 +1,212 @@ +From 6121d5437d7800876567fd08b6020ca1d72eeaac Mon Sep 17 00:00:00 2001 +From: Vratislav Podzimek +Date: Fri, 20 Oct 2017 13:24:20 +0200 +Subject: [PATCH] Add and use a service for cleaning up mount point directories + +When udisks2 is used for mounting devices, it may need to create +the mount point directory. If unmount happens later, udisks2 +cleans after itself and removes the mount point +directory. However, if the unmount happens during reboot, the +udisks2 daemon may already be terminated not having a chance to +do the cleanup. We need a different mechanism to do the job in +such cases. + +systemd provides us with such a mechanism so let's make use of +it. + +Resolves: rhbz#1384796 +Signed-off-by: Vratislav Podzimek +--- + data/Makefile.am | 6 ++-- + data/clean-mount-point@.service | 10 +++++++ + packaging/udisks2.spec | 1 + + src/Makefile.am | 3 +- + src/udiskslinuxfilesystem.c | 61 +++++++++++++++++++++++++++++++++++++++-- + 5 files changed, 74 insertions(+), 7 deletions(-) + create mode 100644 data/clean-mount-point@.service + +diff --git a/data/Makefile.am b/data/Makefile.am +index 83af330..9b8073a 100644 +--- a/data/Makefile.am ++++ b/data/Makefile.am +@@ -15,14 +15,14 @@ dbusconf_DATA = $(dbusconf_in_files:.conf.in=.conf) + $(dbusconf_DATA): $(dbusconf_in_files) Makefile + cp $< $@ + +-systemdservice_in_files = udisks2.service.in ++systemdservice_in_files = udisks2.service.in clean-mount-point@.service + + if HAVE_SYSTEMD + systemdservicedir = $(systemdsystemunitdir) + systemdservice_DATA = $(systemdservice_in_files:.service.in=.service) + +-$(systemdservice_DATA): $(systemdservice_in_files) Makefile +- @sed -e "s|\@udisksdprivdir\@|$(libexecdir)/udisks2|" $< > $@ ++$(systemdservice_DATA): udisks2.service.in Makefile ++ @sed -e "s|\@udisksdprivdir\@|$(libexecdir)/udisks2|" udisks2.service.in > udisks2.service + endif + + udevrulesdir = $(udevdir)/rules.d +diff --git a/data/clean-mount-point@.service b/data/clean-mount-point@.service +new file mode 100644 +index 0000000..83edceb +--- /dev/null ++++ b/data/clean-mount-point@.service +@@ -0,0 +1,10 @@ ++[Unit] ++Description=Clean the %f mount point ++Before=%i.mount ++BindsTo=%i.mount ++DefaultDependencies=no ++ ++[Service] ++Type=oneshot ++RemainAfterExit=true ++ExecStop=/bin/rm -fd %f +diff --git a/src/Makefile.am b/src/Makefile.am +index 396ab4e..3b22cca 100644 +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -113,7 +113,8 @@ libudisks_daemon_la_LIBADD = \ + $(GIO_LIBS) \ + $(GMODULE_LIBS) \ + $(GUDEV_LIBS) \ +- $(BLOCKDEV_LIBS) \ ++ $(BLOCKDEV_LIBS) \ ++ -lbd_utils \ + $(LIBATASMART_LIBS) \ + $(POLKIT_GOBJECT_1_LIBS) \ + $(ACL_LIBS) \ +diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c +index 4cd2784..2910181 100644 +--- a/src/udiskslinuxfilesystem.c ++++ b/src/udiskslinuxfilesystem.c +@@ -86,9 +86,11 @@ G_DEFINE_TYPE_WITH_CODE (UDisksLinuxFilesystem, udisks_linux_filesystem, UDISKS_ + G_IMPLEMENT_INTERFACE (UDISKS_TYPE_FILESYSTEM, filesystem_iface_init)); + + #ifdef HAVE_FHS_MEDIA +-# define MOUNT_BASE "/media" ++#define MOUNT_BASE "/media" ++#define MOUNT_BASE_PERSISTENT TRUE + #else +-# define MOUNT_BASE "/run/media" ++#define MOUNT_BASE "/run/media" ++#define MOUNT_BASE_PERSISTENT FALSE + #endif + + /* ---------------------------------------------------------------------------------------------------- */ +@@ -833,6 +835,7 @@ add_acl (const gchar *path, + * @gid: group id of the calling user + * @user_name: user name of the calling user + * @fs_type: The file system type to mount with ++ * @persistent: if the mount point is persistent (survives reboot) or not + * @error: Return location for error or %NULL. + * + * Calculates the mount point to use. +@@ -846,6 +849,7 @@ calculate_mount_point (UDisksDaemon *daemon, + gid_t gid, + const gchar *user_name, + const gchar *fs_type, ++ gboolean *persistent, + GError **error) + { + UDisksLinuxBlockObject *object = NULL; +@@ -889,6 +893,7 @@ calculate_mount_point (UDisksDaemon *daemon, + if (!fs_shared && (user_name != NULL && strstr (user_name, "/") == NULL)) + { + mount_dir = g_strdup_printf (MOUNT_BASE "/%s", user_name); ++ *persistent = MOUNT_BASE_PERSISTENT; + if (!g_file_test (mount_dir, G_FILE_TEST_EXISTS)) + { + /* First ensure that MOUNT_BASE exists */ +@@ -933,8 +938,10 @@ calculate_mount_point (UDisksDaemon *daemon, + } + } + /* otherwise fall back to mounting in /media */ +- if (mount_dir == NULL) ++ if (mount_dir == NULL) { + mount_dir = g_strdup ("/media"); ++ *persistent = TRUE; ++ } + + /* NOTE: UTF-8 has the nice property that valid UTF-8 strings only contains + * the byte 0x2F if it's for the '/' character (U+002F SOLIDUS). +@@ -1135,6 +1142,49 @@ is_system_managed (UDisksBlock *block, + return ret; + } + ++static void trigger_mpoint_cleanup (const gchar *mount_point) ++{ ++ const gchar *argv[] = {"systemctl", "start", NULL, NULL}; ++ GError *error = NULL; ++ gchar *escaped_mpoint = NULL; ++ gsize len = 0; ++ ++ if (g_str_has_prefix (mount_point, "/")) ++ mount_point++; ++ else ++ udisks_warning ("Invalid mount point given to trigger_mpoint_cleanup(): %s", ++ mount_point); ++ ++ /* start with the mount point without the leading '/' */ ++ escaped_mpoint = g_strdup (mount_point); ++ ++ /* and replace all '/'s with '-'s */ ++ for (gchar *letter = escaped_mpoint; *letter != '\0'; letter++, len++) ++ { ++ if (*letter == '/') ++ *letter = '-'; ++ } ++ ++ /* remove the potential trailing '-' (would happen if the given mount_point ++ has a trailing '/') */ ++ if (escaped_mpoint[len - 1] == '-') ++ escaped_mpoint[len - 1] = '\0'; ++ ++ argv[2] = g_strdup_printf ("clean-mount-point@%s", escaped_mpoint); ++ ++ if (!bd_utils_exec_and_report_error (argv, NULL, &error) && (error != NULL)) ++ { ++ /* this is a best-effort mechanism, if it fails, just log warning and move ++ on */ ++ udisks_warning ("Failed to setup systemd-based mount point cleanup: %s", ++ error->message); ++ g_clear_error (&error); ++ } ++ ++ g_free (escaped_mpoint); ++ g_free ((gchar *) argv[2]); ++} ++ + /* ---------------------------------------------------------------------------------------------------- */ + + /* runs in thread dedicated to handling @invocation */ +@@ -1154,6 +1204,7 @@ handle_mount (UDisksFilesystem *filesystem, + gchar *fs_type_to_use = NULL; + gchar *mount_options_to_use = NULL; + gchar *mount_point_to_use = NULL; ++ gboolean mpoint_persistent = TRUE; + gchar *fstab_mount_options = NULL; + gchar *caller_user_name = NULL; + GError *error = NULL; +@@ -1443,6 +1494,7 @@ handle_mount (UDisksFilesystem *filesystem, + caller_gid, + caller_user_name, + fs_type_to_use, ++ &mpoint_persistent, + &error); + if (mount_point_to_use == NULL) + { +@@ -1487,6 +1539,9 @@ handle_mount (UDisksFilesystem *filesystem, + else + udisks_simple_job_complete (UDISKS_SIMPLE_JOB (job), TRUE, NULL); + ++ if (mpoint_persistent) ++ trigger_mpoint_cleanup (mount_point_to_use); ++ + /* update the mounted-fs file */ + udisks_state_add_mounted_fs (state, + mount_point_to_use, +-- +2.9.5 + diff --git a/SOURCES/udisks-2.1.2-intel_raid.patch b/SOURCES/udisks-2.1.2-intel_raid.patch deleted file mode 100644 index 81e3787..0000000 --- a/SOURCES/udisks-2.1.2-intel_raid.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -up udisks-2.1.2/udisks/udisksclient.c.intel_raid udisks-2.1.2/udisks/udisksclient.c ---- udisks-2.1.2/udisks/udisksclient.c.intel_raid 2015-05-13 12:15:09.979557171 +0200 -+++ udisks-2.1.2/udisks/udisksclient.c 2015-05-13 12:17:51.240957992 +0200 -@@ -1936,8 +1936,8 @@ static const struct - {"raid", "linux_raid_member", NULL, NC_("fs-type", "Linux RAID Member"), NC_("fs-type", "Linux RAID Member")}, - {"raid", "zfs_member", "*", NC_("fs-type", "ZFS Device (ZPool version %s)"), NC_("fs-type", "ZFS (v%s)")}, - {"raid", "zfs_member", NULL, NC_("fs-type", "ZFS Device"), NC_("fs-type", "ZFS")}, -- {"raid", "isw_raid_member", "*", NC_("fs-type", "Intel Matrix RAID Member (version %s)"), NC_("fs-type", "IMSM RAID Member (%s)")}, -- {"raid", "isw_raid_member", NULL, NC_("fs-type", "Intel Matrix RAID Member"), NC_("fs-type", "IMSM RAID")}, -+ {"raid", "isw_raid_member", "*", NC_("fs-type", "Intel Rapid Storage Technology enterprise RAID Member (version %s)"), NC_("fs-type", "Intel RSTe RAID Member (%s)")}, -+ {"raid", "isw_raid_member", NULL, NC_("fs-type", "Intel Rapid Storage Technology enterprise RAID Member"), NC_("fs-type", "Intel RSTe RAID Member")}, - {"crypto", "crypto_LUKS", "*", NC_("fs-type", "LUKS Encryption (version %s)"), NC_("fs-type", "LUKS")}, - {"crypto", "crypto_LUKS", NULL, NC_("fs-type", "LUKS Encryption"), NC_("fs-type", "LUKS")}, - {"filesystem", "VMFS", "*", NC_("fs-type", "VMFS (version %s)"), NC_("fs-type", "VMFS (v%s)")}, diff --git a/SOURCES/udisks-2.1.3-getpwuid-thread-safety.patch b/SOURCES/udisks-2.1.3-getpwuid-thread-safety.patch deleted file mode 100644 index b9c06c7..0000000 --- a/SOURCES/udisks-2.1.3-getpwuid-thread-safety.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 89229c2b0b139c527e98fc3bf1a829bc2b68394e Mon Sep 17 00:00:00 2001 -From: Tomas Bzatek -Date: Wed, 15 Jan 2014 16:16:34 +0000 -Subject: Use reentrant version of getpwuid() for thread safety - -...and get rid of static variables. - -https://bugs.freedesktop.org/show_bug.cgi?id=73669 - -Signed-off-by: David Zeuthen ---- -diff --git a/src/udisksdaemonutil.c b/src/udisksdaemonutil.c -index 574bf2c..b3a3acb 100644 ---- a/src/udisksdaemonutil.c -+++ b/src/udisksdaemonutil.c -@@ -830,7 +830,7 @@ udisks_daemon_util_get_caller_uid_sync (UDisksDaemon *daemon, - { - struct passwd pwstruct; - gchar pwbuf[8192]; -- static struct passwd *pw; -+ struct passwd *pw = NULL; - int rc; - - rc = getpwuid_r (uid, &pwstruct, pwbuf, sizeof pwbuf, &pw); -diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c -index 4c8d8aa..f243046 100644 ---- a/src/udiskslinuxfilesystem.c -+++ b/src/udiskslinuxfilesystem.c -@@ -348,13 +348,16 @@ find_mount_options_for_fs (const gchar *fstype) - static gid_t - find_primary_gid (uid_t uid) - { -- struct passwd *pw; -+ struct passwd *pw = NULL; -+ struct passwd pwstruct; -+ gchar pwbuf[8192]; -+ int rc; - gid_t gid; - - gid = (gid_t) - 1; - -- pw = getpwuid (uid); -- if (pw == NULL) -+ rc = getpwuid_r (uid, &pwstruct, pwbuf, sizeof pwbuf, &pw); -+ if (rc != 0 || pw == NULL) - { - udisks_warning ("Error looking up uid %d: %m", uid); - goto out; -@@ -370,7 +373,10 @@ is_uid_in_gid (uid_t uid, - gid_t gid) - { - gboolean ret; -- struct passwd *pw; -+ struct passwd *pw = NULL; -+ struct passwd pwstruct; -+ gchar pwbuf[8192]; -+ int rc; - static gid_t supplementary_groups[128]; - int num_supplementary_groups = 128; - int n; -@@ -379,8 +385,8 @@ is_uid_in_gid (uid_t uid, - - ret = FALSE; - -- pw = getpwuid (uid); -- if (pw == NULL) -+ rc = getpwuid_r (uid, &pwstruct, pwbuf, sizeof pwbuf, &pw); -+ if (rc != 0 || pw == NULL) - { - udisks_warning ("Error looking up uid %d: %m", uid); - goto out; -diff --git a/src/udisksspawnedjob.c b/src/udisksspawnedjob.c -index 802551f..b181933 100644 ---- a/src/udisksspawnedjob.c -+++ b/src/udisksspawnedjob.c -@@ -371,22 +371,25 @@ static void - child_setup (gpointer user_data) - { - UDisksSpawnedJob *job = UDISKS_SPAWNED_JOB (user_data); -- struct passwd *pw; -+ struct passwd pwstruct; -+ gchar pwbuf[8192]; -+ struct passwd *pw = NULL; -+ int rc; - gid_t egid; - - if (job->run_as_uid == getuid () && job->run_as_euid == geteuid ()) - goto out; - -- pw = getpwuid (job->run_as_euid); -- if (pw == NULL) -+ rc = getpwuid_r (job->run_as_euid, &pwstruct, pwbuf, sizeof pwbuf, &pw); -+ if (rc != 0 || pw == NULL) - { - g_printerr ("No password record for uid %d: %m\n", (gint) job->run_as_euid); - abort (); - } - egid = pw->pw_gid; - -- pw = getpwuid (job->run_as_uid); -- if (pw == NULL) -+ rc = getpwuid_r (job->run_as_uid, &pwstruct, pwbuf, sizeof pwbuf, &pw); -+ if (rc != 0 || pw == NULL) - { - g_printerr ("No password record for uid %d: %m\n", (gint) job->run_as_uid); - abort (); --- -cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.3-udisks_daemon_util_get_caller_uid_sync-missing-goto.patch b/SOURCES/udisks-2.1.3-udisks_daemon_util_get_caller_uid_sync-missing-goto.patch deleted file mode 100644 index 1a0e70e..0000000 --- a/SOURCES/udisks-2.1.3-udisks_daemon_util_get_caller_uid_sync-missing-goto.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 3a384047123abc4a4fe2e81eb5dc4050746aa9e8 Mon Sep 17 00:00:00 2001 -From: Tomas Bzatek -Date: Fri, 17 Jan 2014 16:10:33 +0000 -Subject: udisks_daemon_util_get_caller_uid_sync(): Add missing goto - -Signed-off-by: David Zeuthen ---- -diff --git a/src/udisksdaemonutil.c b/src/udisksdaemonutil.c -index b3a3acb..a588580 100644 ---- a/src/udisksdaemonutil.c -+++ b/src/udisksdaemonutil.c -@@ -840,6 +840,7 @@ udisks_daemon_util_get_caller_uid_sync (UDisksDaemon *daemon, - UDISKS_ERROR, - UDISKS_ERROR_FAILED, - "User with uid %d does not exist", (gint) uid); -+ goto out; - } - else if (pw == NULL) - { --- -cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.3-udisksctl-loop-delete-crash.patch b/SOURCES/udisks-2.1.3-udisksctl-loop-delete-crash.patch deleted file mode 100644 index e4206e9..0000000 --- a/SOURCES/udisks-2.1.3-udisksctl-loop-delete-crash.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 4d867ff2a454a155828a2616cd674b1a8d018260 Mon Sep 17 00:00:00 2001 -From: Tomas Bzatek -Date: Tue, 14 Jan 2014 17:20:19 +0000 -Subject: Fix crash when loop-deleting non-loop device - -When a non-loop device file is specified, a lookup succeeds but it's not -a UDisks2.Loop object. This change prevents a crash when null pointer is -passed further in the calls. - -https://bugzilla.redhat.com/show_bug.cgi?id=1036076 - -Signed-off-by: David Zeuthen ---- -diff --git a/tools/udisksctl.c b/tools/udisksctl.c -index 97b0f17..209c0a3 100644 ---- a/tools/udisksctl.c -+++ b/tools/udisksctl.c -@@ -1691,6 +1691,12 @@ handle_command_loop (gint *argc, - goto out; - } - -+ if (udisks_object_peek_loop (object) == NULL) -+ { -+ g_printerr ("Error: specified object is not a loop device\n"); -+ goto out; -+ } -+ - delete_try_again: - error = NULL; - if (!udisks_loop_call_delete_sync (udisks_object_peek_loop (object), --- -cgit v0.9.0.2-2-gbebe diff --git a/SOURCES/udisks-2.1.3-uninitialized-vars.patch b/SOURCES/udisks-2.1.3-uninitialized-vars.patch deleted file mode 100644 index a757e91..0000000 --- a/SOURCES/udisks-2.1.3-uninitialized-vars.patch +++ /dev/null @@ -1,100 +0,0 @@ -From 5075166d63aaa9d8c6f441d6073a72b24431408b Mon Sep 17 00:00:00 2001 -From: Tomas Bzatek -Date: Wed, 22 Jan 2014 14:29:05 +0100 -Subject: [PATCH 1/3] Properly initialize all used variables - ---- - src/udiskslinuxblock.c | 8 ++++---- - src/udiskslinuxdriveata.c | 2 +- - src/udiskslinuxfilesystem.c | 2 +- - src/udisksstate.c | 2 +- - tools/udisksctl.c | 1 + - 5 files changed, 8 insertions(+), 7 deletions(-) - -diff --git a/src/udiskslinuxblock.c b/src/udiskslinuxblock.c -index 22bcfd0..c72dded 100644 ---- a/src/udiskslinuxblock.c -+++ b/src/udiskslinuxblock.c -@@ -1521,7 +1521,7 @@ handle_add_configuration_item (UDisksBlock *_block, - UDisksLinuxBlockObject *object; - UDisksDaemon *daemon; - const gchar *type; -- GVariant *details; -+ GVariant *details = NULL; - GError *error; - - error = NULL; -@@ -1598,7 +1598,7 @@ handle_remove_configuration_item (UDisksBlock *_block, - UDisksLinuxBlockObject *object; - UDisksDaemon *daemon; - const gchar *type; -- GVariant *details; -+ GVariant *details = NULL; - GError *error; - - error = NULL; -@@ -1677,8 +1677,8 @@ handle_update_configuration_item (UDisksBlock *_block, - UDisksDaemon *daemon; - const gchar *old_type; - const gchar *new_type; -- GVariant *old_details; -- GVariant *new_details; -+ GVariant *old_details = NULL; -+ GVariant *new_details = NULL; - GError *error; - - error = NULL; -diff --git a/src/udiskslinuxdriveata.c b/src/udiskslinuxdriveata.c -index 534ef4d..5c36078 100644 ---- a/src/udiskslinuxdriveata.c -+++ b/src/udiskslinuxdriveata.c -@@ -637,7 +637,7 @@ udisks_linux_drive_ata_smart_selftest_sync (UDisksLinuxDriveAta *drive, - GError **error) - { - UDisksLinuxDriveObject *object; -- UDisksLinuxDevice *device; -+ UDisksLinuxDevice *device = NULL; - SkDisk *d = NULL; - gboolean ret = FALSE; - SkSmartSelfTest test; -diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c -index f243046..4503b51 100644 ---- a/src/udiskslinuxfilesystem.c -+++ b/src/udiskslinuxfilesystem.c -@@ -1558,7 +1558,7 @@ handle_unmount (UDisksFilesystem *filesystem, - GError *error; - uid_t mounted_by_uid; - uid_t caller_uid; -- gint status; -+ gint status = 0; - gchar *error_message; - const gchar *const *mount_points; - gboolean opt_force; -diff --git a/src/udisksstate.c b/src/udisksstate.c -index e7b549a..4dfe393 100644 ---- a/src/udisksstate.c -+++ b/src/udisksstate.c -@@ -530,7 +530,7 @@ udisks_state_check_mounted_fs_entry (UDisksState *state, - const gchar *mount_point; - GVariant *details; - GVariant *block_device_value; -- dev_t block_device; -+ dev_t block_device = 0; - GVariant *fstab_mount_value; - gboolean fstab_mount; - gboolean keep; -diff --git a/tools/udisksctl.c b/tools/udisksctl.c -index 209c0a3..bb1182c 100644 ---- a/tools/udisksctl.c -+++ b/tools/udisksctl.c -@@ -890,6 +890,7 @@ read_passphrase (void) - gchar *ret; - - ret = NULL; -+ str = NULL; - - tty_name = ctermid (NULL); - if (tty_name == NULL) --- -1.8.1.5 - diff --git a/SOURCES/udisks-2.1.3-uninitialized-wait_data.patch b/SOURCES/udisks-2.1.3-uninitialized-wait_data.patch deleted file mode 100644 index 3f4cb23..0000000 --- a/SOURCES/udisks-2.1.3-uninitialized-wait_data.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 951472a6f5914bbc56587d56e97fa40ff1908794 Mon Sep 17 00:00:00 2001 -From: Tomas Bzatek -Date: Wed, 22 Jan 2014 14:42:09 +0100 -Subject: [PATCH 2/3] udiskslinuxmanager.c: Don't use uninitialized wait_data - struct - ---- - src/udiskslinuxmanager.c | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) - -diff --git a/src/udiskslinuxmanager.c b/src/udiskslinuxmanager.c -index d15eba6..53703d1 100644 ---- a/src/udiskslinuxmanager.c -+++ b/src/udiskslinuxmanager.c -@@ -538,7 +538,6 @@ handle_mdraid_create (UDisksManager *_object, - { - UDisksLinuxManager *manager = UDISKS_LINUX_MANAGER (_object); - UDisksObject *array_object = NULL; -- WaitForArrayData wait_data; - uid_t caller_uid; - GError *error = NULL; - const gchar *message; -@@ -778,8 +777,8 @@ handle_mdraid_create (UDisksManager *_object, - if (array_object == NULL) - { - g_prefix_error (&error, -- "Error waiting for array object after creating /dev/md%d", -- wait_data.md_num); -+ "Error waiting for array object after creating %s", -+ raid_device_file); - g_dbus_method_invocation_take_error (invocation, error); - goto out; - } --- -1.8.1.5 - diff --git a/SOURCES/udisks-2.x.x-CVE-2014-0004.patch b/SOURCES/udisks-2.x.x-CVE-2014-0004.patch deleted file mode 100644 index 5794dfd..0000000 --- a/SOURCES/udisks-2.x.x-CVE-2014-0004.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 4cd35a8db2c6a0b94218a89cb183f50e8550de0e Mon Sep 17 00:00:00 2001 -From: David Zeuthen -Date: Wed, 12 Feb 2014 20:01:41 -0800 -Subject: [PATCH] CVE-2014-0004: Stack-based buffer overflow when handling long - path names - -Fix this by being more careful when parsing strings. - -Acknowledgements: This issue was discovered by Florian Weimer of the -Red Hat Product Security Team. - -Signed-off-by: David Zeuthen ---- - src/udisksmountmonitor.c | 21 +++++++++++++-------- - 1 file changed, 13 insertions(+), 8 deletions(-) - -diff --git a/src/udisksmountmonitor.c b/src/udisksmountmonitor.c -index 8af1028..77cf94c 100644 ---- a/src/udisksmountmonitor.c -+++ b/src/udisksmountmonitor.c -@@ -416,8 +416,8 @@ udisks_mount_monitor_get_mountinfo (UDisksMountMonitor *monitor, - guint mount_id; - guint parent_id; - guint major, minor; -- gchar encoded_root[PATH_MAX]; -- gchar encoded_mount_point[PATH_MAX]; -+ gchar encoded_root[4096]; -+ gchar encoded_mount_point[4096]; - gchar *mount_point; - dev_t dev; - -@@ -425,7 +425,7 @@ udisks_mount_monitor_get_mountinfo (UDisksMountMonitor *monitor, - continue; - - if (sscanf (lines[n], -- "%d %d %d:%d %s %s", -+ "%d %d %d:%d %4095s %4095s", - &mount_id, - &parent_id, - &major, -@@ -436,6 +436,8 @@ udisks_mount_monitor_get_mountinfo (UDisksMountMonitor *monitor, - udisks_warning ("Error parsing line '%s'", lines[n]); - continue; - } -+ encoded_root[sizeof encoded_root - 1] = '\0'; -+ encoded_mount_point[sizeof encoded_mount_point - 1] = '\0'; - - /* Temporary work-around for btrfs, see - * -@@ -450,15 +452,17 @@ udisks_mount_monitor_get_mountinfo (UDisksMountMonitor *monitor, - sep = strstr (lines[n], " - "); - if (sep != NULL) - { -- gchar fstype[PATH_MAX]; -- gchar mount_source[PATH_MAX]; -+ gchar fstype[4096]; -+ gchar mount_source[4096]; - struct stat statbuf; - -- if (sscanf (sep + 3, "%s %s", fstype, mount_source) != 2) -+ if (sscanf (sep + 3, "%4095s %4095s", fstype, mount_source) != 2) - { - udisks_warning ("Error parsing things past - for '%s'", lines[n]); - continue; - } -+ fstype[sizeof fstype - 1] = '\0'; -+ mount_source[sizeof mount_source - 1] = '\0'; - - if (g_strcmp0 (fstype, "btrfs") != 0) - continue; -@@ -546,7 +550,7 @@ udisks_mount_monitor_get_swaps (UDisksMountMonitor *monitor, - lines = g_strsplit (contents, "\n", 0); - for (n = 0; lines[n] != NULL; n++) - { -- gchar filename[PATH_MAX]; -+ gchar filename[4096]; - struct stat statbuf; - dev_t dev; - -@@ -557,11 +561,12 @@ udisks_mount_monitor_get_swaps (UDisksMountMonitor *monitor, - if (strlen (lines[n]) == 0) - continue; - -- if (sscanf (lines[n], "%s", filename) != 1) -+ if (sscanf (lines[n], "%4095s", filename) != 1) - { - udisks_warning ("Error parsing line '%s'", lines[n]); - continue; - } -+ filename[sizeof filename - 1] = '\0'; - - if (stat (filename, &statbuf) != 0) - { --- -1.8.5.3 - diff --git a/SOURCES/udisks-2.x.x-cleanup-cdrom.patch b/SOURCES/udisks-2.x.x-cleanup-cdrom.patch deleted file mode 100644 index 5ade5b7..0000000 --- a/SOURCES/udisks-2.x.x-cleanup-cdrom.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 95929aea77992077ea8725c54c4d861f08edbd46 Mon Sep 17 00:00:00 2001 -From: Tomas Bzatek -Date: Thu, 16 Jan 2014 17:37:27 +0100 -Subject: [PATCH] Check if cdrom drive has media on cleanup - -When cleanup is run, it is supposed to remove lingering mounts. -That probably works fine for card readers etc. since there's -a partition exposed for the drive but fails for optical media. -As a result, when mounted and user presses the drive eject -button, tray is ejected but mounts lives on. - -This patch adds a special check for CDROM drives and looks for -active media. - -https://bugs.freedesktop.org/show_bug.cgi?id=72206 ---- - src/udisksstate.c | 19 ++++++++++++++++++- - 1 file changed, 18 insertions(+), 1 deletion(-) - -diff --git a/src/udisksstate.c b/src/udisksstate.c -index e7b549a..73aba4f 100644 ---- a/src/udisksstate.c -+++ b/src/udisksstate.c -@@ -541,6 +541,7 @@ udisks_state_check_mounted_fs_entry (UDisksState *state, - gboolean device_exists; - gboolean device_to_be_cleaned; - gboolean attempt_no_cleanup; -+ gboolean empty_cd_drive; - UDisksMountMonitor *monitor; - GUdevClient *udev_client; - GUdevDevice *udev_device; -@@ -552,6 +553,7 @@ udisks_state_check_mounted_fs_entry (UDisksState *state, - device_exists = FALSE; - device_to_be_cleaned = FALSE; - attempt_no_cleanup = FALSE; -+ empty_cd_drive = FALSE; - block_device_value = NULL; - fstab_mount_value = NULL; - fstab_mount = FALSE; -@@ -651,6 +653,16 @@ udisks_state_check_mounted_fs_entry (UDisksState *state, - g_object_unref (udev_device_disk); - } - } -+ /* for disk, check if it's a cd-rom drive and has media */ -+ else if (g_strcmp0 (g_udev_device_get_devtype (udev_device), "disk") == 0) -+ { -+ device_exists = TRUE; -+ -+ /* taken from udisks_daemon_util_block_get_size() */ -+ if (g_udev_device_get_property_as_boolean (udev_device, "ID_CDROM") && -+ !g_udev_device_get_property_as_boolean (udev_device, "ID_CDROM_MEDIA")) -+ empty_cd_drive = TRUE; -+ } - else - { - device_exists = TRUE; -@@ -670,7 +682,7 @@ udisks_state_check_mounted_fs_entry (UDisksState *state, - } - } - -- if (is_mounted && device_exists && !device_to_be_cleaned) -+ if (is_mounted && device_exists && !device_to_be_cleaned && !empty_cd_drive) - keep = TRUE; - - out: -@@ -679,6 +691,11 @@ udisks_state_check_mounted_fs_entry (UDisksState *state, - { - if (!device_exists) - { -+ udisks_notice ("Cleaning up mount point %s (device %d:%d is CDROM and has no media)", -+ mount_point, major (block_device), minor (block_device)); -+ } -+ else if (!device_exists) -+ { - udisks_notice ("Cleaning up mount point %s (device %d:%d no longer exist)", - mount_point, major (block_device), minor (block_device)); - } --- -1.8.1.5 - diff --git a/SOURCES/umount.udisks2-manpage.patch b/SOURCES/umount.udisks2-manpage.patch deleted file mode 100644 index bf46562..0000000 --- a/SOURCES/umount.udisks2-manpage.patch +++ /dev/null @@ -1,151 +0,0 @@ -From 0229af0d724faa862cde63ec8c0c6448210c532c Mon Sep 17 00:00:00 2001 -From: Matthias Clasen -Date: Wed, 26 Jun 2013 01:10:48 -0400 -Subject: [PATCH] Add a man page for umount.udisks2 - -Some customers get upset if there are commands in /bin or /sbin -without a manual page. Since the umount interface expects its -plugins to be in /sbin, add a pro forma man page for umount.udisks2. - -https://bugs.freedesktop.org/show_bug.cgi?id=66188 ---- - doc/man/Makefile.am | 5 ++++ - doc/man/udisks.xml | 1 + - doc/man/udisksctl.xml | 1 + - doc/man/udisksd.xml | 1 + - doc/man/umount.udisks2.xml | 60 ++++++++++++++++++++++++++++++++++++++++++++++ - 5 files changed, 68 insertions(+) - create mode 100644 doc/man/umount.udisks2.xml - -diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am -index e4e8ca8..97f76dc 100644 ---- a/doc/man/Makefile.am -+++ b/doc/man/Makefile.am -@@ -8,6 +8,7 @@ man_MANS += \ - udisksctl.1 \ - udisksd.8 \ - udisks.8 \ -+ umount.udisks2.8 \ - $(NULL) - endif - -@@ -20,10 +21,14 @@ udisksd.8 : udisksd.xml - udisks.8 : udisks.xml - $(XSLTPROC) -path "$(builddir)/.." -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< - -+umount.udisks2.8 : umount.udisks2.xml -+ $(XSLTPROC) -path "$(builddir)/.." -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< -+ - EXTRA_DIST= \ - udisksctl.xml \ - udisksd.xml \ - udisks.xml \ -+ umount.udisks2.xml \ - $(NULL) - - clean-local: -diff --git a/doc/man/udisks.xml b/doc/man/udisks.xml -index dc32995..e13129c 100644 ---- a/doc/man/udisks.xml -+++ b/doc/man/udisks.xml -@@ -393,6 +393,7 @@ - , - udisksd8, - udisksctl1, -+ umount.udisks28, - gnome-disks1 - - -diff --git a/doc/man/udisksctl.xml b/doc/man/udisksctl.xml -index 8f38479..a87f5f2 100644 ---- a/doc/man/udisksctl.xml -+++ b/doc/man/udisksctl.xml -@@ -332,6 +332,7 @@ - - udisks8, - udisksd8, -+ umount.udisks28, - - polkit8 - -diff --git a/doc/man/udisksd.xml b/doc/man/udisksd.xml -index 4ad7c31..559edf1 100644 ---- a/doc/man/udisksd.xml -+++ b/doc/man/udisksd.xml -@@ -113,6 +113,7 @@ - - udisks8, - udisksctl1, -+ umount.udisks28, - - polkit8 - , -diff --git a/doc/man/umount.udisks2.xml b/doc/man/umount.udisks2.xml -new file mode 100644 -index 0000000..5c0ca0f ---- /dev/null -+++ b/doc/man/umount.udisks2.xml -@@ -0,0 +1,60 @@ -+ -+]> -+ -+ -+ umount.udisks2 -+ March 2013 -+ udisks -+ -+ -+ -+ umount.udisks2 -+ 8 -+ System Administration -+ udisks -+ &version; -+ -+ -+ -+ umount.udisks2 -+ unmount file systems that have been mounted by udisks -+ -+ -+ DESCRIPTION -+ -+ The umount.udisks2 program is a helper for the -+ umount8 -+ program. Its purpose is to clean up automatically created directories -+ created at file system mount-time. It should never be called directly. -+ -+ -+ -+ AUTHOR -+ -+ Written by David Zeuthen -+ with a lot of help -+ from many others. -+ -+ -+ -+ -+ BUGS -+ -+ Please send bug reports to either the distribution bug tracker -+ or the upstream bug tracker at -+ . -+ -+ -+ -+ -+ SEE ALSO -+ -+ udisks8, -+ udisksd8, -+ udisksctl1, -+ umount8, -+ -+ -+ --- -1.8.3.1 - diff --git a/SPECS/udisks2.spec b/SPECS/udisks2.spec index 7d70993..ee106fb 100644 --- a/SPECS/udisks2.spec +++ b/SPECS/udisks2.spec @@ -1,212 +1,289 @@ -%define glib2_version 2.31.13 -%define gobject_introspection_version 1.30.0 -%define polkit_version 0.101 -%define systemd_version 184 -%define libatasmart_version 0.12 -%define dbus_version 1.4.0 - +%global glib2_version 2.36 +%global gobject_introspection_version 1.30.0 +%global polkit_version 0.102 +%global systemd_version 208 +%global libatasmart_version 0.17 +%global dbus_version 1.4.0 +%global with_gtk_doc 1 +%global libblockdev_version 2.10 + +%define is_git %(git show > /dev/null 2>&1 && echo 1 || echo 0) +%define git_hash %(git log -1 --pretty=format:"%h" || true) +%define build_date %(date '+%Y%m%d') + +Name: udisks2 Summary: Disk Manager -Name: udisks2 -Version: 2.1.2 +Version: 2.7.3 Release: 6%{?dist} License: GPLv2+ -Group: System Environment/Libraries -URL: http://www.freedesktop.org/wiki/Software/udisks -Source0: http://udisks.freedesktop.org/releases/udisks-%{version}.tar.bz2 +Group: System Environment/Libraries +URL: https://github.com/storaged-project/udisks +Source0: https://github.com/storaged-project/udisks/releases/download/udisks-%{version}/udisks-%{version}.tar.bz2 + +Patch0: reboot_mpoint_cleanup_1384796.patch +Patch1: raid_watchers_1400056.patch +Patch2: no_discard_1516697.patch +Patch3: fix_thinpool_size_1534904.patch +Patch4: fix_mpoin_cleanup_1384796.patch BuildRequires: glib2-devel >= %{glib2_version} BuildRequires: gobject-introspection-devel >= %{gobject_introspection_version} -BuildRequires: polkit-devel >= %{polkit_version} -BuildRequires: intltool -BuildRequires: libatasmart-devel >= %{libatasmart_version} BuildRequires: libgudev1-devel >= %{systemd_version} -BuildRequires: gtk-doc -BuildRequires: systemd-devel +BuildRequires: libatasmart-devel >= %{libatasmart_version} +BuildRequires: polkit-devel >= %{polkit_version} +BuildRequires: systemd-devel >= %{systemd_version} +BuildRequires: gnome-common BuildRequires: libacl-devel - -# needed to pull in the system bus daemon +BuildRequires: chrpath +BuildRequires: gtk-doc +BuildRequires: intltool +BuildRequires: redhat-rpm-config +BuildRequires: libblockdev-devel >= %{libblockdev_version} +BuildRequires: libblockdev-part-devel >= %{libblockdev_version} +BuildRequires: libblockdev-loop-devel >= %{libblockdev_version} +BuildRequires: libblockdev-swap-devel >= %{libblockdev_version} +BuildRequires: libblockdev-mdraid-devel >= %{libblockdev_version} +BuildRequires: libblockdev-fs-devel >= %{libblockdev_version} +BuildRequires: libblockdev-crypto-devel >= %{libblockdev_version} + +Requires: libblockdev >= %{libblockdev_version} +Requires: libblockdev-part >= %{libblockdev_version} +Requires: libblockdev-loop >= %{libblockdev_version} +Requires: libblockdev-swap >= %{libblockdev_version} +Requires: libblockdev-mdraid >= %{libblockdev_version} +Requires: libblockdev-fs >= %{libblockdev_version} +Requires: libblockdev-crypto >= %{libblockdev_version} + +# Needed for the systemd-related macros used in this file +%{?systemd_requires} +BuildRequires: systemd + +# Needed to pull in the system bus daemon Requires: dbus >= %{dbus_version} -# needed to pull in the udev daemon -Requires: systemd >= %{systemd_version} -# we need at least this version for bugfixes / features etc. +# Needed to pull in the udev daemon +Requires: udev >= %{systemd_version} +# We need at least this version for bugfixes/features etc. Requires: libatasmart >= %{libatasmart_version} -# for mount, umount, mkswap +# For mount, umount, mkswap Requires: util-linux -# for mkfs.ext3, mkfs.ext3, e2label +# For mkfs.ext3, mkfs.ext3, e2label Requires: e2fsprogs -# for mkfs.xfs, xfs_admin +# For mkfs.xfs, xfs_admin Requires: xfsprogs -# for mkfs.vfat +# For mkfs.vfat Requires: dosfstools -# for partitioning -Requires: parted Requires: gdisk -# for LUKS devices -Requires: cryptsetup-luks -# for ejecting removable disks +# For ejecting removable disks Requires: eject -# for MD-RAID -Requires: mdadm +Requires: lib%{name}%{?_isa} = %{version}-%{release} -Requires: libudisks2 = %{version}-%{release} - -# for mkntfs (not available on rhel or on ppc/ppc64) +# For mkntfs (not available on rhel or on ppc/ppc64) %if ! 0%{?rhel} %ifnarch ppc ppc64 Requires: ntfsprogs %endif %endif -# for /proc/self/mountinfo, only available in 2.6.26 or higher -Conflicts: kernel < 2.6.26 - -# https://bugzilla.redhat.com/show_bug.cgi?id=976796 -# ensure smooth upgrade path from udisks(1) -Obsoletes: udisks - -# Some patch touches Makefile.am -BuildRequires: automake autoconf -BuildRequires: gnome-common - - -# add a man page for umount.udisks2 -# https://bugzilla.redhat.com/show_bug.cgi?id=948926 -Patch8: umount.udisks2-manpage.patch +Obsoletes: storaged -# udisks2: udiskctl loop-delete crash -# https://bugzilla.redhat.com/show_bug.cgi?id=1036076 -Patch9: udisks-2.1.3-udisksctl-loop-delete-crash.patch - -# udisks2: thread safety issues -# https://bugzilla.redhat.com/show_bug.cgi?id=1036099 -Patch10: udisks-2.1.3-getpwuid-thread-safety.patch -Patch11: udisks-2.1.3-udisks_daemon_util_get_caller_uid_sync-missing-goto.patch - -# udisks2 doesn't unmount /dev/sr0 when optical media is ejected using optical drive button -# https://bugzilla.redhat.com/show_bug.cgi?id=835120 -Patch12: udisks-2.x.x-cleanup-cdrom.patch +%description +The Udisks project provides a daemon, tools and libraries to access and +manipulate disks, storage devices and technologies. -# Issues found by clang static analyzer -# https://bugzilla.redhat.com/show_bug.cgi?id=1056580 -Patch13: udisks-2.1.3-uninitialized-vars.patch -Patch14: udisks-2.1.3-uninitialized-wait_data.patch +%package -n lib%{name} +Summary: Dynamic library to access the udisksd daemon +Group: System Environment/Libraries +License: LGPLv2+ +Obsoletes: libstoraged -# CVE-2014-0004 -# https://bugzilla.redhat.com/show_bug.cgi?id=1070144 -Patch15: udisks-2.x.x-CVE-2014-0004.patch +%description -n lib%{name} +This package contains the dynamic library, which provides +access to the udisksd daemon. -# Rename the Intel SW RAID -# https://bugzilla.redhat.com/show_bug.cgi?id=1175225 -Patch16: udisks-2.1.2-intel_raid.patch +%package -n %{name}-iscsi +Summary: Module for iSCSI +Group: System Environment/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +License: LGPLv2+ +Requires: iscsi-initiator-utils +BuildRequires: iscsi-initiator-utils-devel +Obsoletes: storaged-iscsi -%description -udisks provides a daemon, D-Bus API and command line tools for -managing disks and storage devices. This package is for the udisks 2.x -series. +%description -n %{name}-iscsi +This package contains module for iSCSI configuration. -%package -n libudisks2 -Summary: Dynamic library to access the udisks daemon +%package -n %{name}-lvm2 +Summary: Module for LVM2 Group: System Environment/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} License: LGPLv2+ +Requires: lvm2 +Requires: libblockdev-lvm >= %{libblockdev_version} +BuildRequires: lvm2-devel +BuildRequires: libblockdev-lvm-devel >= %{libblockdev_version} +Obsoletes: storaged-lvm2 -%description -n libudisks2 -This package contains the dynamic library libudisks2, which provides -access to the udisks daemon. This package is for the udisks 2.x -series. +%description -n %{name}-lvm2 +This package contains module for LVM2 configuration. -%package -n libudisks2-devel -Summary: Development files for libudisks2 +%package -n lib%{name}-devel +Summary: Development files for lib%{name} Group: Development/Libraries -Requires: libudisks2 = %{version}-%{release} -Requires: pkgconfig +Requires: lib%{name}%{?_isa} = %{version}-%{release} License: LGPLv2+ +Obsoletes: libstoraged-devel -%description -n libudisks2-devel -This package contains the development files for the library -libudisks2, a dynamic library, which provides access to the udisks -daemon. This package is for the udisks 2.x series. +%description -n lib%{name}-devel +This package contains the development files for the library lib%{name}, a +dynamic library, which provides access to the udisksd daemon. %prep %setup -q -n udisks-%{version} -%patch8 -p1 -b .umount.udisks2-manpage -%patch9 -p1 -b .udisksctl-loop-delete-crash -%patch10 -p1 -b .getpwuid-thread-safety -%patch11 -p1 -b .udisks_daemon_util_get_caller_uid_sync-missing-goto -%patch12 -p1 -b .cleanup-cdrom -%patch13 -p1 -b .uninitialized-vars -%patch14 -p1 -b .uninitialized-wait_data -%patch15 -p1 -b .cve-2014-0004 -%patch16 -p1 -b .intel_raid +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %build -# umount.udisks2-manpage.patch touches Makefile.am -libtoolize --force || : -aclocal || : -autoheader || : -automake || : -autoconf || : +autoreconf -ivf # we can't use _hardened_build here, see # https://bugzilla.redhat.com/show_bug.cgi?id=892837 export CFLAGS='-fPIC %optflags' export LDFLAGS='-pie -Wl,-z,now -Wl,-z,relro' -%configure --enable-gtk-doc -make +%configure \ + --sysconfdir=/etc \ + --enable-iscsi \ + --enable-lvm2 \ +%if %{with_gtk_doc} + --enable-gtk-doc +%else + --disable-gtk-doc +%endif +make %{?_smp_mflags} %install -make install DESTDIR=$RPM_BUILD_ROOT +make install DESTDIR=%{buildroot} +%if %{with_gtk_doc} == 0 +rm -fr %{buildroot}/%{_datadir}/gtk-doc/html/udisks2 +%endif -rm -f $RPM_BUILD_ROOT%{_libdir}/*.la -rm -f $RPM_BUILD_ROOT%{_libdir}/*.a +find %{buildroot} -name \*.la -o -name \*.a | xargs rm -%find_lang %{name} +chrpath --delete %{buildroot}/%{_sbindir}/umount.udisks2 +chrpath --delete %{buildroot}/%{_bindir}/udisksctl +chrpath --delete %{buildroot}/%{_libexecdir}/udisks2/udisksd -%post -n libudisks2 -p /sbin/ldconfig +%find_lang udisks2 -%postun -n libudisks2 -p /sbin/ldconfig +%post -n %{name} +%systemd_post udisks2.service +%systemd_post clean-mount-point@.service +udevadm control --reload +udevadm trigger -%files -f %{name}.lang -%doc README AUTHORS NEWS COPYING HACKING +%preun -n %{name} +%systemd_preun udisks2.service +%systemd_preun clean-mount-point@.service + +%postun -n %{name} +%systemd_postun_with_restart udisks2.service +%systemd_postun_with_restart clean-mount-point@.service + +%post -n lib%{name} -p /sbin/ldconfig + +%postun -n lib%{name} -p /sbin/ldconfig + +%files -f udisks2.lang +%doc README.md AUTHORS NEWS HACKING +%license COPYING %dir %{_sysconfdir}/udisks2 +%{_sysconfdir}/udisks2/udisks2.conf %{_sysconfdir}/dbus-1/system.d/org.freedesktop.UDisks2.conf %{_datadir}/bash-completion/completions/udisksctl -%{_prefix}/lib/systemd/system/udisks2.service -%{_prefix}/lib/udev/rules.d/80-udisks2.rules +%{_unitdir}/udisks2.service +%{_unitdir}/clean-mount-point@.service +%{_udevrulesdir}/80-udisks2.rules %{_sbindir}/umount.udisks2 -%dir %{_prefix}/lib/udisks2 -%{_prefix}/lib/udisks2/udisksd + +%dir %{_libdir}/udisks2 +%dir %{_libdir}/udisks2/modules +%dir %{_libexecdir}/udisks2 +%{_libexecdir}/udisks2/udisksd %{_bindir}/udisksctl -%{_mandir}/man1/* -%{_mandir}/man8/* +%{_mandir}/man1/udisksctl.1* +%{_mandir}/man5/udisks2.conf.5* +%{_mandir}/man8/udisksd.8* +%{_mandir}/man8/udisks.8* +%{_mandir}/man8/umount.udisks2.8* -%{_datadir}/polkit-1/actions/org.freedesktop.udisks2.policy +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.policy %{_datadir}/dbus-1/system-services/org.freedesktop.UDisks2.service # Permissions for local state data are 0700 to avoid leaking information # about e.g. mounts to unprivileged users %attr(0700,root,root) %dir %{_localstatedir}/lib/udisks2 -%files -n libudisks2 +%files -n lib%{name} %{_libdir}/libudisks2.so.* %{_libdir}/girepository-1.0/UDisks-2.0.typelib -%files -n libudisks2-devel +%files -n %{name}-lvm2 +%{_libdir}/udisks2/modules/libudisks2_lvm2.so +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.lvm2.policy + +%files -n %{name}-iscsi +%{_libdir}/udisks2/modules/libudisks2_iscsi.so +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.iscsi.policy + +%files -n lib%{name}-devel %{_libdir}/libudisks2.so %dir %{_includedir}/udisks2 %dir %{_includedir}/udisks2/udisks %{_includedir}/udisks2/udisks/*.h %{_datadir}/gir-1.0/UDisks-2.0.gir +%if %{with_gtk_doc} %dir %{_datadir}/gtk-doc/html/udisks2 %{_datadir}/gtk-doc/html/udisks2/* +%endif %{_libdir}/pkgconfig/udisks2.pc # Note: please don't forget the %{?dist} in the changelog. Thanks %changelog +* Tue Feb 06 2018 Vojtech Trefny - 2.7.3-6 +- Fix escaping mountpoint for the cleanup service + Related: rhbz#1384796 + +* Mon Feb 05 2018 Vojtech Trefny - 2.7.3-5 +- lvm2: Don't match prefixes in cmp_int_lv_name + Resolves: rhbz#1534904 + +* Thu Nov 30 2017 Vratislav Podzimek - 2.7.3-4 +- Add 'no-discard' option to formatting methods (mvollmer) + Resolves: rhbz#1516697 + +* Mon Oct 23 2017 Vratislav Podzimek - 2.7.3-3 +- Add and use a service for cleaning up mount point directories + Resolves: rhbz#1384796 +- Do not try to create file watchers for RAIDs without redundancy + Resolves: rhbz#1400056 + +* Thu Oct 19 2017 Vratislav Podzimek - 2.7.3-2 +- Put back the hack to ensure hardening + Related: rhbz#1477736 +- Fix the relationship between new udisks2 and storaged + Related: rhbz#1477736 + +* Thu Oct 12 2017 Vratislav Podzimek - 2.7.3-1 +- Rebase to upstream version 2.7.3 + Resolves: rhbz#1477736 + * Wed May 13 2015 Tomas Smetana - 2.1.2-6 - Rename the Intel SW RAID (#1175225) - Resolves: rhbz#1175225