Skip to content

Commit d49a08a

Browse files
committed
cloud-utils-growpart: Workaround for timeout
Regression identified when using flock disk locking with 5.10 kernel and systemd-239. During unlock_disk_and_settle(), udevadm settle will not complete and eventually timeout after 2 minutes. When looking at the systemd-udevd logs, the daemon crashes and produces the following stack trace: Stack trace of thread 1531: #0 0x00007fd73d9be405 recvmsg (libpthread.so.0) #1 0x00007fd73dab33b8 udev_monitor_receive_device (libsystemd-shared-239.so) #2 0x0000600347316201 on_uevent (systemd-udevd) #3 0x0000600347316667 on_inotify (systemd-udevd) #4 0x00007fd73dbad6d7 source_dispatch (libsystemd-shared-239.so) #5 0x00007fd73dbaf4e5 sd_event_dispatch (libsystemd-shared-239.so) #6 0x00007fd73dbaf678 sd_event_run (libsystemd-shared-239.so) #7 0x00007fd73dbaf89f sd_event_loop (libsystemd-shared-239.so) #8 0x00006003473132df run (systemd-udevd) #9 0x00007fd73d80e133 __libc_start_main (libc.so.6) #10 0x0000600347313efe _start (systemd-udevd) The failing behavior appears to be directly linked to the "exec FD" actions. A quick way to replicate this issue in the repro environment: exec 9<>$disk exec 9>&- udevadm settle This patch comments out the initial lock_disk() call, which makes unlock_disk_and_settle() return early because ${FLOCK_DISK_FD} is not set to a valid FD, avoiding the file descriptor actions that lead to the failing behavior. Note that this change does re-introduce the possibility of udev race conditions during the disk operations, effectively reverting this behavior to pre-0.32 behavior. Signed-off-by: Chris Co <chrco@microsoft.com>
1 parent ea1e989 commit d49a08a

2 files changed

Lines changed: 65 additions & 1 deletion

File tree

SPECS/cloud-utils-growpart/cloud-utils-growpart.spec

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Summary: Shell script to auto detect free size on disk and grow partition.
22
Name: cloud-utils-growpart
33
Version: 0.32
4-
Release: 1%{?dist}
4+
Release: 2%{?dist}
55
License: GPLv3
66
Group: System Environment
77
Source0: https://launchpad.net/cloud-utils/trunk/%{version}/+download/cloud-utils-%{version}.tar.gz
@@ -12,6 +12,7 @@ Requires: gptfdisk
1212
Requires: gawk
1313
Requires: util-linux
1414
BuildArch: noarch
15+
Patch0: growpart-remove-flock-disk-locking.patch
1516

1617
%description
1718
Cloud-utils brings in growpart script. This script is very useful for
@@ -20,6 +21,7 @@ This is generally used by cloud-init for disk space manangement on cloud images.
2021

2122
%prep
2223
%setup -q -n cloud-utils-%{version}
24+
%patch0 -p1
2325

2426
%build
2527
%install
@@ -34,6 +36,8 @@ cp man/growpart.* $RPM_BUILD_ROOT/%{_mandir}/man1/
3436
%doc %{_mandir}/man1/growpart.*
3537

3638
%changelog
39+
* Tue Apr 27 2021 Chris Co <chrco@microsoft.com> - 0.32-2
40+
- Add patch to handle unexpected timeout
3741
* Sat Mar 13 2021 Henry Beberman <henry.beberman@microsoft.com> 0.32-1
3842
- Update to version 0.32 for more robust parsing of kernel version in growpart
3943
* Sat May 09 2020 Nick Samson <nisamson@microsoft.com> 0.30-6
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
From 1baf9aed12e35e7c032499081ea1c9887e65626a Mon Sep 17 00:00:00 2001
2+
From: Chris Co <chrco@microsoft.com>
3+
Date: Wed, 28 Apr 2021 05:58:02 +0000
4+
Subject: [PATCH] growpart: remove flock disk locking
5+
6+
Regression identified when using flock disk locking with 5.10 kernel and
7+
systemd-239. During unlock_disk_and_settle(), udevadm settle will not
8+
complete and eventually timeout after 2 minutes. When looking at the
9+
systemd-udevd logs, the daemon crashes and produces the following stack
10+
trace:
11+
12+
Stack trace of thread 1531:
13+
#0 0x00007fd73d9be405 recvmsg (libpthread.so.0)
14+
#1 0x00007fd73dab33b8 udev_monitor_receive_device (libsystemd-shared-239.so)
15+
#2 0x0000600347316201 on_uevent (systemd-udevd)
16+
#3 0x0000600347316667 on_inotify (systemd-udevd)
17+
#4 0x00007fd73dbad6d7 source_dispatch (libsystemd-shared-239.so)
18+
#5 0x00007fd73dbaf4e5 sd_event_dispatch (libsystemd-shared-239.so)
19+
#6 0x00007fd73dbaf678 sd_event_run (libsystemd-shared-239.so)
20+
#7 0x00007fd73dbaf89f sd_event_loop (libsystemd-shared-239.so)
21+
#8 0x00006003473132df run (systemd-udevd)
22+
#9 0x00007fd73d80e133 __libc_start_main (libc.so.6)
23+
#10 0x0000600347313efe _start (systemd-udevd)
24+
25+
The failing behavior appears to be directly linked to the "exec FD"
26+
actions. A quick way to replicate this issue in the repro environment:
27+
exec 9<>$disk
28+
exec 9>&-
29+
udevadm settle
30+
31+
This patch comments out the initial lock_disk() call, which makes
32+
unlock_disk_and_settle() return early because ${FLOCK_DISK_FD} is not
33+
set to a valid FD, avoiding the file descriptor actions that lead to
34+
the failing behavior.
35+
36+
Note that this change does re-introduce the possibility of udev race
37+
conditions during the disk operations, effectively reverting this
38+
behavior to pre-0.32 behavior.
39+
40+
Signed-off-by: Chris Co <chrco@microsoft.com>
41+
---
42+
bin/growpart | 2 +-
43+
1 file changed, 1 insertion(+), 1 deletion(-)
44+
45+
diff --git a/bin/growpart b/bin/growpart
46+
index 994b258..90fa016 100755
47+
--- a/bin/growpart
48+
+++ b/bin/growpart
49+
@@ -954,7 +954,7 @@ get_resizer "$format" "$resizer" ||
50+
fail "failed to get a resizer for format '$format'"
51+
resizer=$_RET
52+
53+
-lock_disk $DISK
54+
+#lock_disk $DISK
55+
debug 1 "resizing $PART on $DISK using $resizer"
56+
"$resizer"
57+
ret=$?
58+
--
59+
2.17.1
60+

0 commit comments

Comments
 (0)