Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

udev: modernize code and propagate critical errors #12700

Merged
merged 12 commits into from
Jun 3, 2019

Conversation

yuwata
Copy link
Member

@yuwata yuwata commented May 30, 2019

Replaces #12416. Closes #12291.

@keszybz I cannot split the 3rd commit. Sorry. Could you take a look?

Copy link
Member

@keszybz keszybz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general. One pattern that I think should be improved is the if (r < 0 && r != -ENOENT) ... if (r == -ENOENT) checks (see one of the comments below). I think it'd be nice to standarize on a single form that uses if ... else if ... to avoid repeated checks of the same condition.

I think we should merge this with some minor changes, and work on follow-up cleanups later.

test/test-network/systemd-networkd-tests.py Outdated Show resolved Hide resolved
test/test-network/systemd-networkd-tests.py Outdated Show resolved Hide resolved
src/basic/fs-util.h Show resolved Hide resolved
src/udev/udev-event.c Show resolved Hide resolved
src/udev/udev-rules.c Show resolved Hide resolved
src/udev/udev-event.c Outdated Show resolved Hide resolved
src/udev/udev-event.c Show resolved Hide resolved
src/udev/udev-rules.c Outdated Show resolved Hide resolved
src/udev/udev-event.c Outdated Show resolved Hide resolved
@keszybz keszybz added the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label May 30, 2019
@keszybz
Copy link
Member

keszybz commented May 30, 2019

Is the first patch here by mistake? I see it also in #12699.

@yuwata
Copy link
Member Author

yuwata commented May 30, 2019

Is the first patch here by mistake? I see it also in #12699.

Seems so. Sorry. Will drop.

@yuwata yuwata force-pushed the udev-propagate-critical-errors branch from d46e716 to fc63ba8 Compare May 30, 2019 09:22
@yuwata yuwata force-pushed the udev-propagate-critical-errors branch from fc63ba8 to 5ac9ba5 Compare May 30, 2019 12:31
@yuwata
Copy link
Member Author

yuwata commented May 30, 2019

@keszybz Thank you for your review. I've force-pushed an updated version. Most of your comments are addressed. Exceptions are MODE_TO_PTR and udev_rule_token_free() things. PTAL.

@yuwata yuwata added ci-fails/needs-rework 🔥 Please rework this, the CI noticed an issue with the PR and removed reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks labels May 30, 2019
@yuwata yuwata force-pushed the udev-propagate-critical-errors branch from 5ac9ba5 to cb85e7b Compare May 30, 2019 15:18
@yuwata
Copy link
Member Author

yuwata commented May 30, 2019

@mrc0mmand Is it possible to obtain udevd's logs during running systemd-networkd-tests.py? It seems some lines are ignored...

@mrc0mmand
Copy link
Member

@yuwata will the Arch VM's journal help? https://ci.centos.org/job/systemd-pr-build/6666/artifact//systemd-centos-ci/artifacts_3_e2Yh/testsuite-logs-upstream.ner/journald-testsuite_PASS.log (it's the journal from the Arch KVM machine, not from the QEMU VMs for test/TEST-??-*)

https://ci.centos.org/job/systemd-pr-build/6666/artifact//systemd-centos-ci/index.html

Also, nice build ID :-)

@yuwata
Copy link
Member Author

yuwata commented May 30, 2019

Thanks!

May 30 17:40:25 n3.pufty.ci.centos.org systemd-udevd[2827]: /usr/lib/udev/rules.d/84-nm-drivers.rules:10 Invalid value for PROGRAM.
May 30 17:40:25 n3.pufty.ci.centos.org systemd-udevd[2827]: /usr/lib/udev/rules.d/98-kexec.rules:1 The line takes no effect, ignoring.
May 30 17:40:25 n3.pufty.ci.centos.org systemd-udevd[2827]: /usr/lib/udev/rules.d/98-kexec.rules:2 The line takes no effect, ignoring.
May 30 17:40:25 n3.pufty.ci.centos.org systemd-udevd[2827]: /usr/lib/udev/rules.d/98-kexec.rules:3 The line takes no effect, ignoring.
May 30 17:40:25 n3.pufty.ci.centos.org systemd-udevd[2827]: /usr/lib/udev/rules.d/98-kexec.rules:4 The line takes no effect, ignoring.

Also, nice build ID :-)

Haha :-)

@yuwata
Copy link
Member Author

yuwata commented May 30, 2019

Hmm, the warnings seem irrelevant... And my laptop works fine with this PR...

@yuwata
Copy link
Member Author

yuwata commented May 31, 2019

Hmm. @mrc0mmand Could you enable debug logging of udevd? Adding udev.log_priority=debug to kernel command line is enough.

@yuwata
Copy link
Member Author

yuwata commented May 31, 2019

Hmm...

Failed to run builtin 'hwdb --subsystem=pci': Invalid argument

@yuwata
Copy link
Member Author

yuwata commented May 31, 2019

Ah, hwdb.bin does not exist, please run 'systemd-hwdb update'

@yuwata yuwata mentioned this pull request Jun 1, 2019
@yuwata yuwata force-pushed the udev-propagate-critical-errors branch 2 times, most recently from e72c444 to e5de67d Compare June 2, 2019 00:58
This does the following:
- rename enum udev_builtin_cmd -> UdevBuiltinCmd
- rename struct udev_builtin -> UdevBuiltin
- move type definitions to udev-rules.h
- move prototypes of functions defined in udev-rules.c to udev-rules.h
- drop to use strbuf
- propagate critical errors in applying rules,
- drop limitation for number of tokens per line.
@yuwata yuwata force-pushed the udev-propagate-critical-errors branch 4 times, most recently from 7eed9bb to fd3eb83 Compare June 2, 2019 12:15
@yuwata yuwata force-pushed the udev-propagate-critical-errors branch from fd3eb83 to d7aee41 Compare June 2, 2019 23:38
@yuwata yuwata removed the ci-fails/needs-rework 🔥 Please rework this, the CI noticed an issue with the PR label Jun 2, 2019
@yuwata
Copy link
Member Author

yuwata commented Jun 2, 2019

I force-pushed a revised version. I hope all CIs will be green. PTAL.

@yuwata
Copy link
Member Author

yuwata commented Jun 3, 2019

Yey! All green now!

@keszybz
Copy link
Member

keszybz commented Jun 3, 2019

LGTM.

@keszybz keszybz merged commit 2bb2488 into systemd:master Jun 3, 2019
@yuwata yuwata deleted the udev-propagate-critical-errors branch June 3, 2019 13:43
@haraldh
Copy link
Member

haraldh commented Feb 25, 2020

This broke dracut in legacy network mode.

#14935

mrc0mmand added a commit to mrc0mmand/dracut that referenced this pull request Feb 26, 2020
The original behavior of $env{INTERFACE} was undocumented and changed in
the recent udev versions, breaking the ability to bring up networking
reliably. Switching to $name directive should fix this issue.

Related links:
 - systemd/systemd#12700 (udev PR)
 - systemd/systemd#12291 (related udev issue)
 - systemd/systemd#14935 (this issue, udev side)
 - dracutdevs#732 (this issue, dracut side)

Fixes: dracutdevs#732
haraldh added a commit to haraldh/dracut that referenced this pull request Feb 27, 2020
The original behavior of $env{INTERFACE} was undocumented and changed in
the recent udev versions, breaking the ability to bring up networking
reliably. Switching to $name directive should fix this issue.

Related links:
 - systemd/systemd#12700 (udev PR)
 - systemd/systemd#12291 (related udev issue)
 - systemd/systemd#14935 (this issue, udev side)
 - dracutdevs#732 (this issue, dracut side)

Fixes: dracutdevs#732
danimo pushed a commit to openSUSE/dracut.old that referenced this pull request May 29, 2020
The original behavior of $env{INTERFACE} was undocumented and changed in
the recent udev versions, breaking the ability to bring up networking
reliably. Switching to $name directive should fix this issue.

Related links:
 - systemd/systemd#12700 (udev PR)
 - systemd/systemd#12291 (related udev issue)
 - systemd/systemd#14935 (this issue, udev side)
 - #732 (this issue, dracut side)

Fixes: #732
(cherry picked from commit a8ba1c4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

udev: RUN assignments and PROGRAM results
4 participants