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

core/dbus-unit: disable service activation while dbus-broker.service … #27570

Closed
wants to merge 1 commit into from
Closed

core/dbus-unit: disable service activation while dbus-broker.service … #27570

wants to merge 1 commit into from

Conversation

Geass-LL
Copy link
Contributor

@Geass-LL Geass-LL commented May 8, 2023

…is deactivating

fix: #26799

@github-actions github-actions bot added util-lib please-review PR is ready for (re-)review by a maintainer labels May 8, 2023
@@ -1858,6 +1859,14 @@ int bus_unit_queue_job(
(type == JOB_RELOAD_OR_START && job_type_collapse(type, u) == JOB_START && u->refuse_manual_start))
return sd_bus_error_setf(error, BUS_ERROR_ONLY_BY_DEPENDENCY, "Operation refused, unit %s may be requested by dependency only (it is configured to refuse manual start/stop).", u->id);

if (u->manager && type == JOB_START && u->type == UNIT_SERVICE) {
Copy link
Member

Choose a reason for hiding this comment

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

The condition u->manager is mostly redundant. If you want, then please add assert(u->manager); at the beginning of the function.

Manager *m = u->manager;
Service *s = SERVICE(u);
if (manager_unit_deactivating_or_pending(m, SPECIAL_DBUS_BROKER_SERVICE) &&
s != NULL && s->type == SERVICE_DBUS)
Copy link
Member

Choose a reason for hiding this comment

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

s != NULL is mostly redundant. If you want to check that, please use ASSERT_PTR().

assert(u->manager);
...
if (type == JOB_START && u->type == UNIT_SERVICE &&
    ASSERT_PTR(SERVICE(u))->type == SERVICE_DBUS &&
    manager_unit_deactivating_or_pending(u->manager, SPECIAL_DBUS_BROKER_SERVICE))
        return sd_bus_error_set(...);

if (u->manager && type == JOB_START && u->type == UNIT_SERVICE) {
Manager *m = u->manager;
Service *s = SERVICE(u);
if (manager_unit_deactivating_or_pending(m, SPECIAL_DBUS_BROKER_SERVICE) &&
Copy link
Member

Choose a reason for hiding this comment

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

Why dbus-broker.service is checked instead of dbus.service? Even if dbus-broker.service is used, IIRC, we assume dbus.service is an alias of dbus-broker.service.

Also, in signal_activation_request(), we checked with manager_unit_inactive_or_pending(). Why not to also use that here?

Copy link
Member

@YHNdnzj YHNdnzj May 8, 2023

Choose a reason for hiding this comment

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

I think it's better to export and use manager_dbus_is_running?

YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request May 8, 2023
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request May 8, 2023
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 systemd#27570
Closes systemd#26799
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request May 8, 2023
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 systemd#27570
Closes systemd#26799
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request May 8, 2023
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 systemd#27570
Closes systemd#26799
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request May 8, 2023
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 systemd#27570
Closes systemd#26799
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request May 8, 2023
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 systemd#27570
Closes systemd#26799
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request May 8, 2023
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 systemd#27570
Closes systemd#26799
YHNdnzj added a commit to YHNdnzj/systemd that referenced this pull request May 8, 2023
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 systemd#27570
Closes systemd#26799
@bluca
Copy link
Member

bluca commented May 8, 2023

superseded by #27579

@bluca bluca closed this May 8, 2023
@bluca bluca removed the please-review PR is ready for (re-)review by a maintainer label May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Disable service activation from dbus-broker while dbus-broker.service is deactivating
4 participants