diff options
author | Marius Vollmer <mvollmer@redhat.com> | 2015-07-13 15:54:47 +0300 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2016-02-29 17:01:38 +0100 |
commit | b1da4173c7586b5190ff4cc814ac6592d98b9c91 (patch) | |
tree | 40325c8cd4e39e63406d7b1263f70be5f7006a25 | |
parent | 7c7a43df1031ed593e541a6eb21b450dffba0579 (diff) | |
download | udisks-b1da4173c7586b5190ff4cc814ac6592d98b9c91.tar.gz |
Catch bogus UUID changes of MDRAIDs
Right before the "remove" event, the UUID of mdraid devices seems to
change sometimes.
Without catching this, we would create a new object for the new UUID
and erroneously dispatch the "remove" event to it. Consequently, the
original object would not receive this event and would continue
watching a non-existent device.
https://bugs.freedesktop.org/show_bug.cgi?id=91326
-rw-r--r-- | src/udiskslinuxprovider.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/udiskslinuxprovider.c b/src/udiskslinuxprovider.c index bbd9866..fca4c0c 100644 --- a/src/udiskslinuxprovider.c +++ b/src/udiskslinuxprovider.c @@ -620,6 +620,21 @@ handle_block_uevent_for_mdraid_with_uuid (UDisksLinuxProvider *provider, /* if uuid is NULL or bogus, consider it a remove event */ if (uuid == NULL || g_strcmp0 (uuid, "00000000:00000000:00000000:00000000") == 0) action = "remove"; + else + { + /* sometimes the bogus UUID looks legit, but it is still bogus. */ + if (!is_member) + { + UDisksLinuxMDRaidObject *candidate = g_hash_table_lookup (provider->sysfs_path_to_mdraid, sysfs_path); + if (candidate != NULL && + g_strcmp0 (uuid, udisks_linux_mdraid_object_get_uuid (candidate)) != 0) + { + udisks_debug ("UUID of %s became bogus (changed from %s to %s)", + sysfs_path, udisks_linux_mdraid_object_get_uuid (candidate), uuid); + action = "remove"; + } + } + } if (g_strcmp0 (action, "remove") == 0) { |