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

(RHEL-40878) Backport support for %systemd_postun_with_reload #250

Merged
merged 7 commits into from
Jun 13, 2024

Conversation

jamacku
Copy link
Member

@jamacku jamacku commented Mar 28, 2024

I am just trying to backport support for %systemd_postun_with_reload and backporting fix for (systemd/systemd#26799) along the way. I'll split it into two PRs if we go with the backport.

%systemd_postun_with_reload could be helpful in cases like this:

/cc @kdudka

@github-actions github-actions bot added tracker/missing Formerly needs-bz pr/needs-ci Formerly needs-ci pr/needs-review Formerly needs-review labels Mar 28, 2024
Copy link

github-actions bot commented Mar 28, 2024

Commit validation

Tracker - RHEL-40878

The following commits meet all requirements

commit upstream
d06d1da - core/manager: export manager_dbus_is_running systemd/systemd@e886315
2d52883 - core: refuse dbus activation if dbus is not running systemd/systemd@53964fd
f360e0f - core: only refuse Type=dbus service enqueuing if dbus has stop job systemd/systemd@bee6e75
138ea93 - Revert "core/manager: export manager_dbus_is_running" and partially "c… systemd/systemd@2b68053
4bf9210 - manager: fix reloading in reload-or-restart --marked systemd/systemd@8ea8e23
6b68f8d - rpm: add systemd_postun_with_reload and `systemd_user_postun_with_re… systemd/systemd@631d2b0
8b43fd1 - rpm: add systemd_user_daemon_reexec systemd/systemd@9ff28e3

Tracker validation

Success

🟢 Tracker RHEL-40878 has set desired product: CentOS Stream 9
🟢 Tracker RHEL-40878 has set desired component: systemd
🟢 Tracker RHEL-40878 has been approved


Pull Request validation

Success

🟢 CI - All checks have passed
🟢 Review - Reviewed by a member
🟢 Approval - Changes were approved


Auto Merge

Success

🟢 Pull Request is not marked as draft and it's not blocked by dont-merge label
🟢 Pull Request meet requirements, title has correct form
🟢 Pull Request meet requirements, mergeable is true
🟢 Pull Request meet requirements, mergeable_state is clean
🟢 Pull Request has correct target branch main
🟢 Pull Request was merged

@github-actions github-actions bot removed the tracker/missing Formerly needs-bz label Jun 12, 2024
@github-actions github-actions bot changed the title Backport support for %systemd_postun_with_reload (RHEL-40878) Backport support for %systemd_postun_with_reload Jun 12, 2024
YHNdnzj and others added 7 commits June 13, 2024 14:52
(cherry picked from commit e886315)

Resolves: RHEL-40878
dbus-broker issues StartUnit directly for activation requests,
so let's add a check on bus state in bus_unit_queue_job to refuse
that if dbus is not running.

Replaces #27570
Closes #26799

(cherry picked from commit 53964fd)

Resolves: RHEL-40878
Follow-up for #27579

In #27579 we refused all StartUnit requests for Type=dbus units
if dbus is not running, which means if dbus is manually stopped,
user can't use systemctl to start Type=dbus units again, which
is incorrect.

The only culprit that leads to the cancellation of the whole
transaction mentioned in #26799 is job type conflict on dbus.
So let's relax the restriction and only refuse job enqueuing
if dbus has a stop job.

To summarize, the case we want to avoid is:

1. dbus has a stop job installed
2. StartUnit/ActivationRequest is received
3. Type=dbus service gets started, which has Requires=dbus.socket
4. dbus is pulled in again, resulting in job type conflict

What we can support is:

1. dbus is already stopped
2. StartUnit is received (possibly through systemctl, i.e. on private bus)
3. Type=dbus service gets started, which will wait for dbus to start
4. dbus is started again, thus the job for Type=dbus service

Replaces #27590
Fixes #27588

(cherry picked from commit bee6e75)

Resolves: RHEL-40878
…core: refuse dbus activation if dbus is not running"

This reverts commit e886315
and partially 53964fd.

Specifically, changes to signal_activation_request()
is not desired.

(cherry picked from commit 2b68053)

Resolves: RHEL-40878
bus_unit_queue_job_one has two callers:
- bus_unit_queue_job which would do the appropriate transormations
  to turn JOB_TRY_RESTART into JOB_TRY_RELOAD,
- and method_enqueue_marked_jobs which did not.
In effect, method_enqueue_marked_jobs() would queue restart jobs for
units which has Markers= needs-reload or needs-restart.

When the chunk of code which does the transformations is moved from
bus_unit_queue_job to bus_unit_queue_job_one, there is no change for
bus_unit_queue_job, and method_enqueue_marked_jobs is fixed.

The additional checks that are done seem reasonable to do from
method_enqueue_marked_jobs: we shouldn't be restarting units which are
configured to not allow that, or force unwanted start of dbus-broker.

(cherry picked from commit 8ea8e23)

Resolves: RHEL-40878
…eload`

For some units, the package would like to issue a reload. The machinery was
already in place since c9615f7:

  systemctl reload-or-restart --marked

  Enqueues restart jobs for all units that have the 'needs-restart'
  mark, and reload jobs for units that have the 'needs-reload' mark.
  When a unit marked for reload does not support reload, restart will
  be queued.

The new macros allow a reload to be issued instead of a restart.

Based on the discussion on fedora-devel:
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/IJSUGIEJNYZZRE53FF4YFUEBRHRAVIXR/

Tested using dummy package https://github.com/keszybz/rpm-test-reload.

(cherry picked from commit 631d2b0)

Resolves: RHEL-40878
This macros wraps the call to daemon-reexec in all user managers. It would be
called for example from systemd %post right after the call to systemctl
daemon-reexec.

This will be used in the Fedora systemd package to fix a long-standing FIXME.

Tested via building and reinstalling the systemd package with the patches.

(cherry picked from commit 9ff28e3)

Resolves: RHEL-40878
@jamacku jamacku modified the milestone: RHEL-9.5.0 Jun 13, 2024
@github-actions github-actions bot removed the pr/needs-ci Formerly needs-ci label Jun 13, 2024
@github-actions github-actions bot merged commit 2400e5c into redhat-plumbers:main Jun 13, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants