1
0
mirror of https://github.com/systemd/systemd synced 2026-03-18 02:54:47 +01:00

Compare commits

..

7 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
f7047b8c1c mailmap: deduplicate some frequent contributors 2026-01-14 17:07:18 +01:00
DaanDeMeyer
90e80b9e8b docs: Document practice of using comments for argument names 2026-01-14 16:52:58 +01:00
Yu Watanabe
18de7dd90f integration tests: do not adjust log level of udevd in the test script
Similar to 5c60d3011feac20dcc3c66fe2bcafa0a889e33d1, but for udevd.
2026-01-14 16:32:38 +01:00
Yu Watanabe
04f05d9bd7 network: drop fallback logic for kernel older than v5.6
Now our baseline is kernel v5.10.
2026-01-14 16:31:12 +01:00
Zbigniew Jędrzejewski-Szmek
6e78240e64
udev: silence notification failures (#40275)
Closes #39943.
2026-01-14 16:26:00 +01:00
Yu Watanabe
472404aca5 udev: downgrade log level about failure in notification
These may fail on shutdown/reboot, as the notification socket is already
closed.

Closes #39943.
2026-01-05 07:25:16 +09:00
Yu Watanabe
36c557f7d4 daemon-util: introduce notify_remove_fd()
It is equivalent to notify_remove_fd_warn() but logs in debug level on
failure.
2026-01-05 07:24:54 +09:00
19 changed files with 49 additions and 84 deletions

View File

@ -36,6 +36,9 @@ Daniel Stekloff <dsteklof@us.ibm.com>
Daniel Șerbănescu <dasj19@users.noreply.github.com>
Dann Frazier <dann.frazier@canonical.com>
Dave Reisner <dreisner@archlinux.org> <d@falconindy.com>
David Rheinsberg <david@readahead.eu>
David Rheinsberg <dh.herrmann@gmail.com>
David Rheinsberg <dh.herrmann@googlemail.com>
David Santamaría Rogado <howl.nsp@gmail.com>
David Zeuthen <david@fubar.dk>
David Zeuthen <david@fubar.dk> <davidz@redhat.com>
@ -91,7 +94,9 @@ José Bollo <jose.bollo@iot.bzh> <jobol@nonadev.net>
Jun Bo Bi <jambonmcyeah@gmail.com>
Justin Capella <justincapella@gmail.com> <b1tninja@users.noreply.github.com>
Jérémy Rosen <jeremy.rosen@enst-bretagne.fr>
Jörg Behrmann <behrmann@physik.fu-berlin.de>
Jürg Billeter <j@bitron.ch>
Kai Lüke <kailuke@microsoft.com>
Karl Kraus <karl.kraus@tum.de> <laqueray@gmail.com>
Kay Sievers <kay@vrfy.org>
Kay Sievers <kay@vrfy.org> <kay.sievers@suse.de>

View File

@ -247,6 +247,24 @@ SPDX-License-Identifier: LGPL-2.1-or-later
const char *input);
```
- When passing `NULL` or another value meaning "unset" to a function, use a comment
to indicate the argument name to make it more clear where we're passing an "unset"
value.
Bad:
```c
myfunction(NULL, NULL, NULL);
```
Good:
```c
myfunction(/* a= */ NULL, /* b= */ NULL, /* c= */ NULL);
```
This guidance should be applied tree-wide, including in test files.
- Please do not introduce new circular dependencies between header files.
Effectively this means that if a.h includes b.h, then b.h cannot include a.h,
directly or transitively via another header. Circular header dependencies can

View File

@ -2329,38 +2329,6 @@ static int link_update_driver(Link *link, sd_netlink_message *message) {
return 1; /* needs reconfigure */
}
static int link_update_permanent_hardware_address_from_ethtool(Link *link, sd_netlink_message *message) {
int r;
assert(link);
assert(link->manager);
assert(message);
if (link->ethtool_permanent_hw_addr_read)
return 0;
/* When udevd is running, read the permanent hardware address after the interface is
* initialized by udevd. Otherwise, ethtool may not work correctly. See issue #22538.
* When udevd is not running, read the value when the interface is detected. */
if (udev_available() && !link->dev)
return 0;
/* If the interface does not have a hardware address, then it will not have a permanent address either. */
r = netlink_message_read_hw_addr(message, IFLA_ADDRESS, NULL);
if (r == -ENODATA)
return 0;
if (r < 0)
return log_link_debug_errno(link, r, "Failed to read IFLA_ADDRESS attribute: %m");
link->ethtool_permanent_hw_addr_read = true;
r = ethtool_get_permanent_hw_addr(&link->manager->ethtool_fd, link->ifname, &link->permanent_hw_addr);
if (r < 0)
log_link_debug_errno(link, r, "Permanent hardware address not found, continuing without: %m");
return 0;
}
static int link_update_permanent_hardware_address(Link *link, sd_netlink_message *message) {
int r;
@ -2372,15 +2340,10 @@ static int link_update_permanent_hardware_address(Link *link, sd_netlink_message
return 0;
r = netlink_message_read_hw_addr(message, IFLA_PERM_ADDRESS, &link->permanent_hw_addr);
if (r < 0) {
if (r != -ENODATA)
return log_link_debug_errno(link, r, "Failed to read IFLA_PERM_ADDRESS attribute: %m");
/* Fallback to ethtool for kernels older than v5.6 (f74877a5457d34d604dba6dbbb13c4c05bac8b93). */
r = link_update_permanent_hardware_address_from_ethtool(link, message);
if (r == -ENODATA)
return 0;
if (r < 0)
return r;
}
return log_link_debug_errno(link, r, "Failed to read IFLA_PERM_ADDRESS attribute: %m");
if (link->permanent_hw_addr.length > 0)
log_link_debug(link, "Saved permanent hardware address: %s", HW_ADDR_TO_STR(&link->permanent_hw_addr));

View File

@ -9,7 +9,7 @@
#include "string-util.h"
#include "time-util.h"
int notify_remove_fd_warn(const char *name) {
static int notify_remove_fd_full(int log_level, const char *name) {
int r;
assert(name);
@ -18,13 +18,22 @@ int notify_remove_fd_warn(const char *name) {
"FDSTOREREMOVE=1\n"
"FDNAME=%s", name);
if (r < 0)
return log_warning_errno(r,
return log_full_errno(
log_level, r,
"Failed to remove file descriptor \"%s\" from the store, ignoring: %m",
name);
return 0;
}
int notify_remove_fd(const char *name) {
return notify_remove_fd_full(LOG_DEBUG, name);
}
int notify_remove_fd_warn(const char *name) {
return notify_remove_fd_full(LOG_WARNING, name);
}
int notify_remove_fd_warnf(const char *format, ...) {
_cleanup_free_ char *p = NULL;
va_list ap;

View File

@ -21,6 +21,7 @@ static inline void notify_on_cleanup(const char **p) {
(void) sd_notify(false, *p);
}
int notify_remove_fd(const char *name);
int notify_remove_fd_warn(const char *name);
int notify_remove_fd_warnf(const char *format, ...) _printf_(1, 2);
int close_and_notify_warn(int fd, const char *name);

View File

@ -557,9 +557,10 @@ int manager_serialize_config(Manager *manager) {
if (r < 0)
return log_warning_errno(r, "Failed to finalize serialization file: %m");
/* This may fail on shutdown/reboot. Let's not warn louder. */
r = notify_push_fd(fileno(f), "config-serialization");
if (r < 0)
return log_warning_errno(r, "Failed to push serialization fd to service manager: %m");
return log_debug_errno(r, "Failed to push serialization fd to service manager: %m");
log_debug("Serialized configurations.");
return 0;

View File

@ -1503,7 +1503,7 @@ int manager_main(Manager *manager) {
/* We will start processing events in the loop below. Before starting processing, let's remove the
* event serialization fd from the fdstore, to avoid retrieving the serialized events again in future
* invocations. Otherwise, the serialized events may be processed multiple times. */
(void) notify_remove_fd_warn("event-serialization");
(void) notify_remove_fd("event-serialization");
r = sd_event_loop(manager->event);
if (r < 0)

View File

@ -3,8 +3,6 @@
set -ex
set -o pipefail
udevadm control --log-level=debug
IFNAME=test-udev-aaa
ip link add "$IFNAME" type dummy
IFINDEX=$(ip -json link show "$IFNAME" | jq '.[].ifindex')
@ -17,6 +15,4 @@ udevadm wait --timeout=10 --removed --settle "/sys/class/net/$IFNAME"
# CHeck if the database file is removed.
[[ ! -e "/run/udev/data/n$IFINDEX" ]]
udevadm control --log-level=info
exit 0

View File

@ -19,14 +19,10 @@ at_exit() (
systemctl daemon-reload
[[ -d "$TMPDIR" ]] && rm -rf "$TMPDIR"
udevadm control --log-level=info
)
trap at_exit EXIT
udevadm control --log-level=debug
TMPDIR="$(mktemp -d)"
truncate -s 16M "$TMPDIR"/foo.raw
mkfs.ext4 -L foo "$TMPDIR"/foo.raw

View File

@ -6,8 +6,6 @@ set -o pipefail
# shellcheck source=test/units/util.sh
. "$(dirname "$0")"/util.sh
udevadm control --log-level=debug
mkdir -p /run/systemd/network/
cat >/run/systemd/network/10-test.link <<EOF
[Match]
@ -198,6 +196,6 @@ ip link del dev test1
rm -f /run/systemd/network/10-test.link
rm -rf /run/systemd/network/10-test.link.d
udevadm control --reload --log-level=info
udevadm control --reload
exit 0

View File

@ -11,14 +11,10 @@ at_exit() (
set +e
[[ -d "$TMPDIR" ]] && rm -rf "$TMPDIR"
udevadm control --log-level=info
)
trap at_exit EXIT
udevadm control --log-level=debug
TMPDIR="$(mktemp -d)"
truncate -s 16M "$TMPDIR"/foo.raw
mkfs.ext4 "$TMPDIR"/foo.raw

View File

@ -15,7 +15,7 @@ OriginalName=testif
Name=te!st!if
EOF
udevadm control --log-level=debug --reload
udevadm control --reload
# Check if any interfaces originally named with '!' in their name have been renamed unexpectedly.
ip link add 'hoge!foo' type dummy
@ -41,6 +41,6 @@ ip link del dev 'te!st!if'
# cleanup
rm -f /run/systemd/network/10-rename-test.link
udevadm control --log-level=info --reload
udevadm control --reload
exit 0

View File

@ -22,8 +22,6 @@ EOF
udevadm control --reload
}
udevadm control --log-level=debug
create_link_file test1
ip link add address 00:50:56:c0:00:18 type dummy
udevadm wait --settle --timeout=30 /sys/class/net/test1
@ -81,6 +79,6 @@ assert_not_in "altname hoge" "$output"
ip link del dev test3
rm -f /run/systemd/network/10-test.link
udevadm control --reload --log-level=info
udevadm control --reload
exit 0

View File

@ -24,7 +24,7 @@ ACTION=="add", RUN+="/usr/bin/bash -c ':> /tmp/marker'", RUN+="/usr/bin/sleep 10
LABEL="end"
EOF
udevadm control --reload --log-level=debug
udevadm control --reload
udevadm settle --timeout 30
rm -f /tmp/marker

View File

@ -80,10 +80,6 @@ cat >/run/udev/rules.d/50-testsuite.rules <<EOF
ACTION=="add", SUBSYSTEM=="block", KERNEL=="sda", OPTIONS:="watch"
EOF
# To make the previous invocation of systemd-udevd generates debugging logs on stop,
# that will be checked by check().
udevadm control --log-level debug
# Unfortunately, journalctl --invocation= is unstable when debug logging is enabled on service manager.
SAVED_LOG_LEVEL=$(systemctl log-level)
systemctl log-level info

View File

@ -29,9 +29,6 @@ EOF
systemctl daemon-reexec
udevadm control --log-level debug
ARGS=()
STATE_DIRECTORY=/var/lib/private/
if [[ -v ASAN_OPTIONS || -v UBSAN_OPTIONS ]]; then

View File

@ -118,8 +118,6 @@ else
exit 1
fi
udevadm control --log-level=debug
IMAGE_DIR="$(mktemp -d --tmpdir="" TEST-50-IMAGES.XXX)"
chmod go+rx "$IMAGE_DIR"
cp -v /usr/share/minimal* "$IMAGE_DIR/"

View File

@ -22,10 +22,6 @@ export SYSTEMD_UTF8=0
seed=750b6cd5c4ae4012a15e7be3c29e6a47
if ! systemd-detect-virt --quiet --container; then
udevadm control --log-level debug
fi
esp_guid=C12A7328-F81F-11D2-BA4B-00A0C93EC93B
xbootldr_guid=BC13C2FF-59E6-4262-A352-B275FD6F7172

View File

@ -1348,7 +1348,6 @@ testcase_mdadm_lvm() {
}
udevadm settle
udevadm control --log-level debug
lsblk -a
echo "Check if all symlinks under /dev/disk/ are valid (pre-test)"
@ -1368,8 +1367,6 @@ udevadm settle --timeout=60
echo "Check if all symlinks under /dev/disk/ are valid (post-test)"
helper_check_device_symlinks
udevadm control --log-level info
systemctl status systemd-udevd
touch /testok