Merge ~paelzer/ubuntu/+source/quota:fix-1774431-cosmic into ubuntu/+source/quota:ubuntu/devel

Proposed by Christian Ehrhardt 
Status: Merged
Merge reported by: Christian Ehrhardt 
Merged at revision: 2ed9316544f8bc60706fe1ccd93a5bbcb01555ae
Proposed branch: ~paelzer/ubuntu/+source/quota:fix-1774431-cosmic
Merge into: ubuntu/+source/quota:ubuntu/devel
Diff against target: 129 lines (+95/-1)
4 files modified
debian/changelog (+8/-0)
debian/control (+2/-1)
debian/patches/lp-1774431-fix-Listen-on-a-TCP-socket.patch (+84/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Andreas Hasenack Approve
Canonical Server Pending
git-ubuntu developers Pending
Review via email: mp+347372@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Backport of upstream fix, version with the fix not yet released but Bionic is affected.
So pushing it to cosmic and then bionic would fix upgraders that are blocked on this.

Test builds at https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/3281

Steps to reproduce (from bug)
sudo apt install rpcbind quota

To let the service start at all one need:
- Add ",usrquota" to your fstab options somewhere
- Add a fake export to /etc/exports like
  /tmp 127.0.0.1
- RPCRQUOTADOPTS="-p 599" in /etc/default/quota
- systemctl restart quotarpc.service

=> check top

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Confirmed that the cpu usage problem is fixed with the new packages. I didn't test quota itself, though.

In terms of the branch, running update-maintainer was missed :)

review: Needs Fixing
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I'm switching this to "approved" because what's needed is just a trivial change, and there is no need to review again because of that.

review: Approve
c4e38ef... by Christian Ehrhardt 

update-maintainer

Signed-off-by: Christian Ehrhardt <email address hidden>

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Thanks, added the maintainer; tagged and uploaded

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 48323b9..2755e26 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+quota (4.04-2ubuntu1) cosmic; urgency=medium
7+
8+ * d/p/lp-1774431-fix-Listen-on-a-TCP-socket.patch: avoid issues with TCP
9+ sockets hogging quota at 100% cpu (LP: #1774431 Can be dropped next
10+ release >4.04 as the patch is upstream already).
11+
12+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Mon, 04 Jun 2018 09:13:16 +0200
13+
14 quota (4.04-2) unstable; urgency=medium
15
16 * Bumped Standards-Version to 4.1.3, no changes needed.
17diff --git a/debian/control b/debian/control
18index 8cb5bbd..2e839b1 100644
19--- a/debian/control
20+++ b/debian/control
21@@ -1,7 +1,8 @@
22 Source: quota
23 Section: admin
24 Priority: optional
25-Maintainer: Michael Meskes <meskes@debian.org>
26+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
27+XSBC-Original-Maintainer: Michael Meskes <meskes@debian.org>
28 Build-Depends: debhelper (>= 11), gettext, libwrap0-dev,
29 e2fslibs-dev, po-debconf (>= 0.5.0), libldap2-dev,
30 quilt (>= 0.46-7), libnl-3-dev, libnl-genl-3-dev, libdbus-1-dev,
31diff --git a/debian/patches/lp-1774431-fix-Listen-on-a-TCP-socket.patch b/debian/patches/lp-1774431-fix-Listen-on-a-TCP-socket.patch
32new file mode 100644
33index 0000000..ffd3d99
34--- /dev/null
35+++ b/debian/patches/lp-1774431-fix-Listen-on-a-TCP-socket.patch
36@@ -0,0 +1,84 @@
37+From 31ecd29b3b3f51145fd78f63087c10e9fcadf999 Mon Sep 17 00:00:00 2001
38+From: Steve Dickson <steved@redhat.com>
39+Date: Tue, 22 May 2018 12:41:59 +0200
40+Subject: [PATCH] Listen on a TCP socket
41+MIME-Version: 1.0
42+Content-Type: text/plain; charset=UTF-8
43+Content-Transfer-Encoding: 8bit
44+
45+rpc.rquotad spins in libtirpc's rendezvous_request() on accepting TCP
46+connections because the polled TCP socket is not listening:
47+
48+poll([{fd=4, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}, {fd=5,
49+ events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}, {fd=6,
50+ events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}, {fd=7,
51+ events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 4, -1) = 2 ([{fd=5,
52+ revents=POLLHUP}, {fd=7, revents=POLLHUP}])
53+accept(5, 0x7ffe61698700, [128]) = -1 EINVAL (Invalid argument)
54+accept(7, 0x7ffe61698700, [128]) = -1 EINVAL (Invalid argument)
55+
56+The polled descriptors are:
57+
58+rpc.rquot 21981 root 4u IPv4 80449159 0t0 UDP *:rquotad
59+rpc.rquot 21981 root 5u sock 0,9 0t0 80449162 protocol: TCP
60+rpc.rquot 21981 root 6u IPv6 80449165 0t0 UDP *:rquotad
61+rpc.rquot 21981 root 7u sock 0,9 0t0 80449168 protocol: TCPv6
62+
63+That results into a high CPU usage just after staring rpc.rquotad
64+process.
65+
66+This patch adds a listen() call to svc_create_sock()
67+routine which is needed with libtirpc version of svc_tli_create()
68+as well as a needed IPv6 setsockopt().
69+
70+Signed-off-by: Petr Písař <ppisar@redhat.com>
71+
72+Author: Christian Ehrhardt <christian.ehrhardt@canonical.com>
73+Original-Author: Steve Dickson <steved@redhat.com>
74+Origin: backport, https://sourceforge.net/p/linuxquota/code/ci/77440bd389425a9a79265f52783e6d39535f199f/
75+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1774431
76+Last-Update: 2018-06-03
77+
78+---
79+ svc_socket.c | 18 ++++++++++++++++++
80+ 1 file changed, 18 insertions(+)
81+
82+diff --git a/svc_socket.c b/svc_socket.c
83+index 8a44604..d2e3abf 100644
84+--- a/svc_socket.c
85++++ b/svc_socket.c
86+@@ -118,6 +118,15 @@ static int svc_create_sock(struct addrinfo *ai)
87+ return -1;
88+ }
89+
90++ if (ai->ai_family == AF_INET6) {
91++ if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY,
92++ &optval, sizeof(optval)) < 0) {
93++ errstr(_("Cannot set IPv6 socket options: %s\n"), strerror(errno));
94++ close(fd);
95++ return -1;
96++ }
97++ }
98++
99+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(optval)) < 0) {
100+ errstr(_("Cannot set socket options: %s\n"), strerror(errno));
101+ close(fd);
102+@@ -129,6 +138,15 @@ static int svc_create_sock(struct addrinfo *ai)
103+ close(fd);
104+ return -1;
105+ }
106++
107++ if (ai->ai_protocol == IPPROTO_TCP) {
108++ if (listen(fd, SOMAXCONN) < 0) {
109++ errstr(_("Cannot listen to address: %s\n"), strerror(errno));
110++ close(fd);
111++ return -1;
112++ }
113++ }
114++
115+ return fd;
116+ }
117+
118+--
119+2.14.3
120+
121diff --git a/debian/patches/series b/debian/patches/series
122index dd4a5c4..55ce852 100644
123--- a/debian/patches/series
124+++ b/debian/patches/series
125@@ -1,3 +1,4 @@
126 editor.diff
127 loop.diff
128
129+lp-1774431-fix-Listen-on-a-TCP-socket.patch

Subscribers

People subscribed via source and target branches