|
|
049be7 |
From e039516b103eb9749a3e261c5ee1a9bc110676cf Mon Sep 17 00:00:00 2001
|
|
|
049be7 |
From: Tomas Bzatek <tbzatek@redhat.com>
|
|
|
049be7 |
Date: Fri, 26 Jun 2020 17:42:32 +0200
|
|
|
049be7 |
Subject: [PATCH 1/8] daemon: Always flush interface property changes
|
|
|
049be7 |
|
|
|
049be7 |
Setting properties on a GDBusInterfaceSkeleton from the main thread
|
|
|
049be7 |
as a result of uevent is somewhat racy to clients that are waiting
|
|
|
049be7 |
for a method call to return that is processed in a separate thread
|
|
|
049be7 |
by the daemon. Perhaps there's a race in the GDBus worker thread
|
|
|
049be7 |
that processes changes from both threads and send them out on the bus.
|
|
|
049be7 |
|
|
|
049be7 |
Explicit flush on GDBusInterfaceSkeleton interfaces seems to fix
|
|
|
049be7 |
the issue. Such approach was used before on some places, this change
|
|
|
049be7 |
adds explicit flushes at all places where properties may change.
|
|
|
049be7 |
---
|
|
|
049be7 |
src/udiskslinuxblock.c | 2 ++
|
|
|
049be7 |
src/udiskslinuxdrive.c | 1 +
|
|
|
049be7 |
src/udiskslinuxdriveata.c | 5 +++++
|
|
|
049be7 |
src/udiskslinuxencrypted.c | 5 +++++
|
|
|
049be7 |
src/udiskslinuxfilesystem.c | 3 +++
|
|
|
049be7 |
src/udiskslinuxloop.c | 1 +
|
|
|
049be7 |
src/udiskslinuxmdraid.c | 1 +
|
|
|
049be7 |
src/udiskslinuxpartition.c | 2 ++
|
|
|
049be7 |
src/udiskslinuxpartitiontable.c | 1 +
|
|
|
049be7 |
src/udiskslinuxswapspace.c | 1 +
|
|
|
049be7 |
10 files changed, 22 insertions(+)
|
|
|
049be7 |
|
|
|
049be7 |
diff --git a/src/udiskslinuxblock.c b/src/udiskslinuxblock.c
|
|
|
049be7 |
index ddc7fe1f..34d73f0e 100644
|
|
|
049be7 |
--- a/src/udiskslinuxblock.c
|
|
|
049be7 |
+++ b/src/udiskslinuxblock.c
|
|
|
049be7 |
@@ -893,6 +893,7 @@ update_configuration (UDisksLinuxBlock *block,
|
|
|
049be7 |
configuration = g_variant_new ("a(sa{sv})", NULL);
|
|
|
049be7 |
}
|
|
|
049be7 |
udisks_block_set_configuration (UDISKS_BLOCK (block), configuration);
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (block));
|
|
|
049be7 |
}
|
|
|
049be7 |
|
|
|
049be7 |
#ifdef HAVE_LIBMOUNT_UTAB
|
|
|
049be7 |
@@ -1280,6 +1281,7 @@ udisks_linux_block_update (UDisksLinuxBlock *block,
|
|
|
049be7 |
update_mdraid (block, device, drive, object_manager);
|
|
|
049be7 |
|
|
|
049be7 |
out:
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (block));
|
|
|
049be7 |
if (device != NULL)
|
|
|
049be7 |
g_object_unref (device);
|
|
|
049be7 |
if (drive != NULL)
|
|
|
049be7 |
diff --git a/src/udiskslinuxdrive.c b/src/udiskslinuxdrive.c
|
|
|
049be7 |
index e9dd7117..28a90ce9 100644
|
|
|
049be7 |
--- a/src/udiskslinuxdrive.c
|
|
|
049be7 |
+++ b/src/udiskslinuxdrive.c
|
|
|
049be7 |
@@ -950,6 +950,7 @@ udisks_linux_drive_update (UDisksLinuxDrive *drive,
|
|
|
049be7 |
ret = update_configuration (drive, object);
|
|
|
049be7 |
|
|
|
049be7 |
out:
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (drive));
|
|
|
049be7 |
if (device != NULL)
|
|
|
049be7 |
g_clear_object (&device);
|
|
|
049be7 |
|
|
|
049be7 |
diff --git a/src/udiskslinuxdriveata.c b/src/udiskslinuxdriveata.c
|
|
|
049be7 |
index d65f3254..4ba66d09 100644
|
|
|
049be7 |
--- a/src/udiskslinuxdriveata.c
|
|
|
049be7 |
+++ b/src/udiskslinuxdriveata.c
|
|
|
049be7 |
@@ -339,6 +339,8 @@ udisks_linux_drive_ata_update (UDisksLinuxDriveAta *drive,
|
|
|
049be7 |
update_security (drive, device);
|
|
|
049be7 |
|
|
|
049be7 |
out:
|
|
|
049be7 |
+ /* ensure property changes are sent before the method return */
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (drive));
|
|
|
049be7 |
if (device != NULL)
|
|
|
049be7 |
g_object_unref (device);
|
|
|
049be7 |
|
|
|
049be7 |
@@ -681,6 +683,9 @@ udisks_linux_drive_ata_refresh_smart_sync (UDisksLinuxDriveAta *drive,
|
|
|
049be7 |
/* update stats again to account for the IO we just did to read the SMART info */
|
|
|
049be7 |
update_io_stats (drive, device);
|
|
|
049be7 |
|
|
|
049be7 |
+ /* ensure property changes are sent before the method return */
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (drive));
|
|
|
049be7 |
+
|
|
|
049be7 |
out:
|
|
|
049be7 |
g_clear_object (&device);
|
|
|
049be7 |
if (d != NULL)
|
|
|
049be7 |
diff --git a/src/udiskslinuxencrypted.c b/src/udiskslinuxencrypted.c
|
|
|
049be7 |
index 73c78873..8a230fda 100644
|
|
|
049be7 |
--- a/src/udiskslinuxencrypted.c
|
|
|
049be7 |
+++ b/src/udiskslinuxencrypted.c
|
|
|
049be7 |
@@ -237,6 +237,8 @@ udisks_linux_encrypted_update (UDisksLinuxEncrypted *encrypted,
|
|
|
049be7 |
update_metadata_size (encrypted, object);
|
|
|
049be7 |
|
|
|
049be7 |
udisks_linux_block_encrypted_unlock (block);
|
|
|
049be7 |
+
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (encrypted));
|
|
|
049be7 |
}
|
|
|
049be7 |
|
|
|
049be7 |
/* ---------------------------------------------------------------------------------------------------- */
|
|
|
049be7 |
@@ -630,6 +632,9 @@ handle_unlock (UDisksEncrypted *encrypted,
|
|
|
049be7 |
g_udev_device_get_sysfs_attr (cleartext_device->udev_device, "dm/uuid"),
|
|
|
049be7 |
caller_uid);
|
|
|
049be7 |
|
|
|
049be7 |
+ /* ensure property changes are sent before the method return */
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (encrypted));
|
|
|
049be7 |
+
|
|
|
049be7 |
udisks_encrypted_complete_unlock (encrypted,
|
|
|
049be7 |
invocation,
|
|
|
049be7 |
g_dbus_object_get_object_path (G_DBUS_OBJECT (cleartext_object)));
|
|
|
049be7 |
diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c
|
|
|
049be7 |
index 669fc40b..3ae11c32 100644
|
|
|
049be7 |
--- a/src/udiskslinuxfilesystem.c
|
|
|
049be7 |
+++ b/src/udiskslinuxfilesystem.c
|
|
|
049be7 |
@@ -277,6 +277,8 @@ udisks_linux_filesystem_update (UDisksLinuxFilesystem *filesystem,
|
|
|
049be7 |
if (! skip_fs_size)
|
|
|
049be7 |
udisks_filesystem_set_size (UDISKS_FILESYSTEM (filesystem), get_filesystem_size (object));
|
|
|
049be7 |
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (filesystem));
|
|
|
049be7 |
+
|
|
|
049be7 |
g_object_unref (device);
|
|
|
049be7 |
}
|
|
|
049be7 |
|
|
|
049be7 |
@@ -1865,6 +1867,7 @@ handle_resize (UDisksFilesystem *filesystem,
|
|
|
049be7 |
UDISKS_DEFAULT_WAIT_TIMEOUT);
|
|
|
049be7 |
|
|
|
049be7 |
udisks_filesystem_set_size (filesystem, get_filesystem_size (UDISKS_LINUX_BLOCK_OBJECT (object)));
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (filesystem));
|
|
|
049be7 |
udisks_filesystem_complete_resize (filesystem, invocation);
|
|
|
049be7 |
udisks_simple_job_complete (UDISKS_SIMPLE_JOB (job), TRUE, NULL);
|
|
|
049be7 |
|
|
|
049be7 |
diff --git a/src/udiskslinuxloop.c b/src/udiskslinuxloop.c
|
|
|
049be7 |
index 6c8a4561..5d7e3553 100644
|
|
|
049be7 |
--- a/src/udiskslinuxloop.c
|
|
|
049be7 |
+++ b/src/udiskslinuxloop.c
|
|
|
049be7 |
@@ -187,6 +187,7 @@ udisks_linux_loop_update (UDisksLinuxLoop *loop,
|
|
|
049be7 |
}
|
|
|
049be7 |
udisks_loop_set_setup_by_uid (UDISKS_LOOP (loop), setup_by_uid);
|
|
|
049be7 |
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (loop));
|
|
|
049be7 |
g_object_unref (device);
|
|
|
049be7 |
}
|
|
|
049be7 |
|
|
|
049be7 |
diff --git a/src/udiskslinuxmdraid.c b/src/udiskslinuxmdraid.c
|
|
|
049be7 |
index 85fc2a3b..7eca9764 100644
|
|
|
049be7 |
--- a/src/udiskslinuxmdraid.c
|
|
|
049be7 |
+++ b/src/udiskslinuxmdraid.c
|
|
|
049be7 |
@@ -512,6 +512,7 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid,
|
|
|
049be7 |
uuid));
|
|
|
049be7 |
|
|
|
049be7 |
out:
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (mdraid));
|
|
|
049be7 |
if (raid_data)
|
|
|
049be7 |
bd_md_examine_data_free (raid_data);
|
|
|
049be7 |
g_free (sync_completed);
|
|
|
049be7 |
diff --git a/src/udiskslinuxpartition.c b/src/udiskslinuxpartition.c
|
|
|
049be7 |
index 97ba02fe..ff0fdfc0 100644
|
|
|
049be7 |
--- a/src/udiskslinuxpartition.c
|
|
|
049be7 |
+++ b/src/udiskslinuxpartition.c
|
|
|
049be7 |
@@ -312,6 +312,8 @@ udisks_linux_partition_update (UDisksLinuxPartition *partition,
|
|
|
049be7 |
udisks_partition_set_is_container (UDISKS_PARTITION (partition), is_container);
|
|
|
049be7 |
udisks_partition_set_is_contained (UDISKS_PARTITION (partition), is_contained);
|
|
|
049be7 |
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (partition));
|
|
|
049be7 |
+
|
|
|
049be7 |
g_free (name);
|
|
|
049be7 |
g_clear_object (&device);
|
|
|
049be7 |
g_clear_object (&disk_block_object);
|
|
|
049be7 |
diff --git a/src/udiskslinuxpartitiontable.c b/src/udiskslinuxpartitiontable.c
|
|
|
049be7 |
index b26849bc..e43a0708 100644
|
|
|
049be7 |
--- a/src/udiskslinuxpartitiontable.c
|
|
|
049be7 |
+++ b/src/udiskslinuxpartitiontable.c
|
|
|
049be7 |
@@ -146,6 +146,7 @@ udisks_linux_partition_table_update (UDisksLinuxPartitionTable *table,
|
|
|
049be7 |
|
|
|
049be7 |
udisks_partition_table_set_partitions (UDISKS_PARTITION_TABLE (table),
|
|
|
049be7 |
partition_object_paths);
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (table));
|
|
|
049be7 |
|
|
|
049be7 |
|
|
|
049be7 |
g_free (partition_object_paths);
|
|
|
049be7 |
diff --git a/src/udiskslinuxswapspace.c b/src/udiskslinuxswapspace.c
|
|
|
049be7 |
index ee103528..bb47f3d4 100644
|
|
|
049be7 |
--- a/src/udiskslinuxswapspace.c
|
|
|
049be7 |
+++ b/src/udiskslinuxswapspace.c
|
|
|
049be7 |
@@ -127,6 +127,7 @@ udisks_linux_swapspace_update (UDisksLinuxSwapspace *swapspace,
|
|
|
049be7 |
active = TRUE;
|
|
|
049be7 |
udisks_swapspace_set_active (UDISKS_SWAPSPACE (swapspace), active);
|
|
|
049be7 |
|
|
|
049be7 |
+ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (swapspace));
|
|
|
049be7 |
g_object_unref (device);
|
|
|
049be7 |
}
|
|
|
049be7 |
|
|
|
049be7 |
--
|
|
|
049be7 |
2.26.2
|
|
|
049be7 |
|