Hi, I would love to see this bug fixed in Jessie.
I've cherry-picked the upstream fix on top of Jessie's 2.1.3-5, and with the resulting package I can't reproduce the bug anymore on Jessie, while creating a partition + filesystem on a USB stick that reproduces the bug about 75% of the time without the patch. I'm attaching the commits I added on top of the debian/2.1.3-5 tag. Shall I go ahead and file a stable-pu request to the stable release managers? Cheers, -- intrigeri
>From 597e051dbc532dd686ee052eeb37964340eef137 Mon Sep 17 00:00:00 2001 From: intrigeri <[email protected]> Date: Sun, 4 Dec 2016 09:36:34 +0000 Subject: [PATCH 1/2] Lock-the-partition-table-while-creating-a-new-partition.patch: new patch, cherry-picked from upstream (Closes: #767457). --- ...tion-table-while-creating-a-new-partition.patch | 90 ++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 91 insertions(+) create mode 100644 debian/patches/Lock-the-partition-table-while-creating-a-new-partition.patch diff --git a/debian/patches/Lock-the-partition-table-while-creating-a-new-partition.patch b/debian/patches/Lock-the-partition-table-while-creating-a-new-partition.patch new file mode 100644 index 0000000..6442f1d --- /dev/null +++ b/debian/patches/Lock-the-partition-table-while-creating-a-new-partition.patch @@ -0,0 +1,90 @@ +From: Marius Vollmer <[email protected]> +Date: Wed, 25 May 2016 15:09:23 +0300 +Bug: https://bugs.freedesktop.org/show_bug.cgi?id=85477 +Bug-Debian: https://bugs.debian.org/767457 +Origin: upstream, https://cgit.freedesktop.org/udisks/commit/?id=554daa4bd058f776f3cc2e23d4b5404179be37f9 +Subject: Lock the partition table while creating a new partition + +This is hopefully a better fix than 5c859c99df to + +https://bugs.freedesktop.org/show_bug.cgi?id=85477 +https://bugs.debian.org/767457 +https://launchpad.net/bugs/1460602 +--- + src/udiskslinuxpartitiontable.c | 42 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + +diff --git a/src/udiskslinuxpartitiontable.c b/src/udiskslinuxpartitiontable.c +index 17fa518..7913e9c 100644 +--- a/src/udiskslinuxpartitiontable.c ++++ b/src/udiskslinuxpartitiontable.c +@@ -26,6 +26,8 @@ + #include <grp.h> + #include <string.h> + #include <stdlib.h> ++#include <fcntl.h> ++#include <sys/file.h> + + #include <glib/gstdio.h> + +@@ -317,6 +319,27 @@ wait_for_partition (UDisksDaemon *daemon, + + #define MIB_SIZE (1048576L) + ++static int ++flock_block_dev (UDisksPartitionTable *iface) ++{ ++ UDisksObject *object = udisks_daemon_util_dup_object (iface, NULL); ++ UDisksBlock *block = object? udisks_object_peek_block (object) : NULL; ++ int fd = block? open (udisks_block_get_device (block), O_RDONLY) : -1; ++ ++ if (fd >= 0) ++ flock (fd, LOCK_SH | LOCK_NB); ++ ++ g_clear_object (&object); ++ return fd; ++} ++ ++static void ++unflock_block_dev (int fd) ++{ ++ if (fd >= 0) ++ close (fd); ++} ++ + /* runs in thread dedicated to handling @invocation */ + static gboolean + handle_create_partition (UDisksPartitionTable *table, +@@ -345,6 +368,24 @@ handle_create_partition (UDisksPartitionTable *table, + gid_t caller_gid; + gboolean do_wipe = TRUE; + GError *error; ++ int lock_fd; ++ ++ /* We (try to) take a shared lock on the partition table while ++ creating and formatting a new partition. ++ ++ This lock prevents udevd from issuing a BLKRRPART ioctl call. ++ That ioctl is undesired because it might temporarily remove the ++ block device of the newly created block device. It does so only ++ temporarily, but it still happens that the block device is ++ missing exactly when wipefs or mkfs try to access it. ++ ++ Also, a pair of remove/add events will cause udisks to create a ++ new internal UDisksObject to represent the block device of the ++ partition. The code currently doesn't handle this and waits for ++ changes (such as an expected filesystem type or UUID) to a ++ obsolete internal object that will never see them. ++ */ ++ lock_fd = flock_block_dev (table); + + error = NULL; + object = udisks_daemon_util_dup_object (table, &error); +@@ -672,6 +713,7 @@ handle_create_partition (UDisksPartitionTable *table, + g_free (error_message); + g_clear_object (&object); + g_clear_object (&block); ++ unflock_block_dev (lock_fd); + return TRUE; /* returning TRUE means that we handled the method invocation */ + } + diff --git a/debian/patches/series b/debian/patches/series index edf2bd5..828d606 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ mount_in_media.patch unsupported_acls.patch libsystemd.patch +Lock-the-partition-table-while-creating-a-new-partition.patch -- 2.10.2
>From f0a604932a2c9734641b2562f30ac367fb149d9d Mon Sep 17 00:00:00 2001 From: intrigeri <[email protected]> Date: Sun, 4 Dec 2016 09:37:48 +0000 Subject: [PATCH 2/2] Update debian/changelog Gbp-Dch: Ignore --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 27f62fc..5cdeba5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +udisks2 (2.1.3-5.0tails1) UNRELEASED; urgency=medium + + * Lock-the-partition-table-while-creating-a-new-partition.patch: + new patch, cherry-picked from upstream (Closes: #767457). + + -- intrigeri <[email protected]> Sun, 04 Dec 2016 09:37:14 +0000 + udisks2 (2.1.3-5) unstable; urgency=medium * Mark gir and dev package as Multi-Arch: same. -- 2.10.2
_______________________________________________ Pkg-utopia-maintainers mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-utopia-maintainers
