summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-01-12 05:24:54 +0900
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-01-11 21:52:23 +0100
commitee0b9e721a368742ac6fa9c3d9a33e45dc3203a2 (patch)
treeec47359128acddc6ed8e23043ee3c3cc823b7027 /src
parent28daa1d10d6dd30ea62a154e4b2adc93d955edda (diff)
downloadsystemd-ee0b9e721a368742ac6fa9c3d9a33e45dc3203a2.tar.gz
systemd-ee0b9e721a368742ac6fa9c3d9a33e45dc3203a2.tar.bz2
systemd-ee0b9e721a368742ac6fa9c3d9a33e45dc3203a2.zip
sd-device-monitor: fix ordering of setting buffer size
By b1c097af8df58a94cba031a347061b7cb9b62d9b (#10239), the receive buffer size for uevents was set by SO_RCVBUF at first, and fallback to use SO_RCVBUFFORCE. So, as SO_RCVBUF limits to the buffer size net.core.rmem_max, which is usually much smaller than 128MB udevd requests, uevents buffer size was not sufficient. This fixes the ordering of the request: SO_RCVBUFFORCE first, and fallback to SO_RCVBUF. Then, udevd's uevent buffer size can be set to 128MB. This also revert 903893237a2105b05671fe87b8f5d5e7417040d2. Fixes #11314 and #10754.
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-device/device-monitor.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/libsystemd/sd-device/device-monitor.c b/src/libsystemd/sd-device/device-monitor.c
index b86932663e..a6230d382a 100644
--- a/src/libsystemd/sd-device/device-monitor.c
+++ b/src/libsystemd/sd-device/device-monitor.c
@@ -93,14 +93,8 @@ _public_ int sd_device_monitor_set_receive_buffer_size(sd_device_monitor *m, siz
assert_return(m, -EINVAL);
assert_return((size_t) n == size, -EINVAL);
- if (m->bound)
- return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
- "sd-device-monitor: Socket fd is already bound. "
- "It may be dangerous to change buffer size. "
- "Refusing to change buffer size.");
-
- if (setsockopt_int(m->sock, SOL_SOCKET, SO_RCVBUF, n) < 0) {
- r = setsockopt_int(m->sock, SOL_SOCKET, SO_RCVBUFFORCE, n);
+ if (setsockopt_int(m->sock, SOL_SOCKET, SO_RCVBUFFORCE, n) < 0) {
+ r = setsockopt_int(m->sock, SOL_SOCKET, SO_RCVBUF, n);
if (r < 0)
return r;
}