summaryrefslogtreecommitdiff
path: root/src/core/transaction.c
AgeCommit message (Collapse)Author
2013-05-02Add __attribute__((const, pure, format)) in various placesZbigniew Jędrzejewski-Szmek
I'm assuming that it's fine if a _const_ or _pure_ function calls assert. It is assumed that the assert won't trigger, and even if it does, it can only trigger on the first call with a given set of parameters, and we don't care if the compiler moves the order of calls.
2013-04-18Move bus_error to dbus-common and remove bus_error_message_or_strerrorSimon Peeters
bus_error and bus_error_message_or_strerror dit almost exactly the same, so use only one of them and place it in dbus-common.
2013-02-28core/transaction: replace a bare status_printf()Michal Schmidt
Like other status messages, this one too should not be printed unconditionally, but it should take the manager state into account. unit_status_printf() does that.
2013-02-22core, systemctl: add support for irreversible jobsMichal Schmidt
Add a new job mode: replace-irreversibly. Jobs enqueued using this mode cannot be implicitly canceled by later enqueued conflicting jobs. They can however still be canceled with an explicit "systemctl cancel" call.
2013-02-09shutdown: issue a sync() as soon as shutdown.target is queuedLennart Poettering
2013-01-06systemd: use unit logging macrosZbigniew Jędrzejewski-Szmek
2012-11-15systemd: highlight ordering cycle deletionsOlivier Brunel
Having unit(s) removed/not started, even if it solved the issue and allowed to boot successfully, should still be considered an error, as something clearly isn't right. This patch elevates the log message from warning to error, and adds a status message to make things more obvious.
2012-09-13man: fix a bunch of typos in docsThomas Hindoe Paaboel Andersen
https://bugs.freedesktop.org/show_bug.cgi?id=54501
2012-07-26systemd: added new dependency PartOfMichal Sekletar
This should address TODO item "new dependency type to "group" services in a target". Semantic of new dependency is as follows. Once configured it creates dependency which will cause that all dependent units get stopped if unit they all depend on is stopped or restarted. Usual use case would be configuring PartOf=some.target in template unit file and WantedBy=some.target in [Install] section and enabling desired number of instances. In this case starting one instance won't pull in target but stopping or starting target(in case of WantedBy is properly configured) will cause stop/start of all instances.
2012-07-13unit: rename BindTo= to BindsTo=Lennart Poettering
all other dependencies are in 3rd person. Change BindTo= accordingly to BindsTo=. Of course, the dependency is widely used, hence we parse the old name too for compatibility.
2012-04-25core: add NOP jobs, job type collapsingMichal Schmidt
Two of our current job types are special: JOB_TRY_RESTART, JOB_RELOAD_OR_START. They differ from other job types by being sensitive to the unit active state. They perform some action when the unit is active and some other action otherwise. This raises a question: when exactly should the unit state be checked to make the decision? Currently the unit state is checked when the job becomes runnable. It's more sensible to check the state immediately when the job is added by the user. When the user types "systemctl try-restart foo.service", he really intends to restart the service if it's running right now. If it isn't running right now, the restart is pointless. Consider the example (from Bugzilla[1]): sleep.service takes some time to start. hello.service has After=sleep.service. Both services get started. Two jobs will appear: hello.service/start waiting sleep.service/start running Then someone runs "systemctl try-restart hello.service". Currently the try-restart operation will block and wait for sleep.service/start to complete. The correct result is to complete the try-restart operation immediately with success, because hello.service is not running. The two original jobs must not be disturbed by this. To fix this we introduce two new concepts: - a new job type: JOB_NOP A JOB_NOP job does not do anything to the unit. It does not pull in any dependencies. It is always immediately runnable. When installed to a unit, it sits in a special slot (u->nop_job) where it never conflicts with the installed job (u->job) of a different type. It never merges with jobs of other types, but it can merge into an already installed JOB_NOP job. - "collapsing" of job types When a job of one of the two special types is added, the state of the unit is checked immediately and the job type changes: JOB_TRY_RESTART -> JOB_RESTART or JOB_NOP JOB_RELOAD_OR_START -> JOB_RELOAD or JOB_START Should a job type JOB_RELOAD_OR_START appear later during job merging, it collapses immediately afterwards. Collapsing actually makes some things simpler, because there are now fewer job types that are allowed in the transaction. [1] Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=753586
2012-04-24service: introduce Type=idle and use it for gettysLennart Poettering
Type=idle is much like Type=simple, however between the fork() and the exec() in the child we wait until PID 1 informs us that no jobs are left. This is mostly a cosmetic fix to make gettys appear only after all boot output is finished and complete. Note that this does not impact the normal job logic as we do not delay the completion of any jobs. We just delay the invocation of the actual binary, and only for services that otherwise would be of Type=simple.
2012-04-23transaction: cancel jobs non-recursively on isolateMichal Schmidt
Recursive cancellation of jobs would trigger OnFailure actions of dependent jobs. This is not desirable when isolating. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=798328
2012-04-24transaction: abort does not need to use recursive deletionMichal Schmidt
Recursion is unnecessary, because we're deleting all transaction jobs anyway. And the recursive deletion produces debug messages that are pointless in transaction abort.
2012-04-24transaction: fix detection of cycles involving installed jobsMichal Schmidt
A transaction can be acyclic, but when it's added to installed jobs, a cycle may result. transaction_verify_order_one() attempts to detect these cases, but it fails because the installed jobs often have the exact generation number that makes them look as if they were walked already. Fix it by resetting the generation numbers of all installed jobs before detecting cycles. An alternative fix could be to add the generation counter to the Manager and use it instead of starting always from 1 in transaction_activate(). But I prefer not having to worry about it wrapping around.
2012-04-24transaction: improve readabilityMichal Schmidt
The functions looked complicated with the nested loops with breaks, continues, and "while (again)". Here using goto actually makes them easier to understand. Also correcting the comment about redundant jobs.
2012-04-22transaction: downgrade warnings about masked unitsLennart Poettering
2012-04-22transaction: add missing emacs and license headersLennart Poettering
2012-04-20transaction: add starting requirements for JOB_RESTARTMichal Schmidt
While having a Requires= dependency between units, the dependency is started automatically on "systemctl start", but it's not started on "systemctl restart". JOB_RESTART jobs did not pull the dependencies for starting into the transaction. https://bugzilla.redhat.com/show_bug.cgi?id=802770 Note that the other bug noted in comment #2 has been fixed already by avoiding the deletion of anchor jobs.
2012-04-20transaction: remove checks for installedMichal Schmidt
Transactions cannot contain installed jobs anymore. Remove the now pointless checks.
2012-04-20transaction: rework merging with installed jobsMichal Schmidt
Previously transactions could reference installed jobs. It made some issues difficult to fix. This sets new rules for jobs: A job cannot be both a member of a transaction and installed. When jobs are created, they are linked to a transaction. The whole transaction is constructed (with merging of jobs within, etc.). When it's complete, all the jobs are unlinked from it one by one and let to install themselves. It is during the installation when merging with previously installed jobs (from older transactions) is contemplated. Merging with installed jobs has different rules than merging within a transaction: - An installed conflicting job gets cancelled. It cannot be simply deleted, because someone might be waiting for its completion on DBus. - An installed, but still waiting, job can be safely merged into. - An installed and running job can be tricky. For some job types it is safe to just merge. For the other types we merge anyway, but put the job back into JOB_WAITING to allow it to run again. This may be suboptimal, but it is not currently possible to have more than one installed job for a unit. Note this also fixes a bug where the anchor job could be deleted during merging within the transaction.
2012-04-20job: separate job_install()Michal Schmidt
Let the jobs install themselves.
2012-04-20transaction: remove a couple of assertsMichal Schmidt
We already asserted these facts in the previous loop.
2012-04-20transaction: remove the anchor linkMichal Schmidt
tr->anchor_job is sufficient.
2012-04-20transaction: avoid garbage collecting the anchor jobMichal Schmidt
Make sure the anchor job is never considered garbage, even if it has no links leading to it (this will be allowed in the next patch).
2012-04-20transaction: simplify transaction_find_jobs_that_matter_to_anchor()Michal Schmidt
2012-04-20transaction: change the linking of isolate jobs to the anchorMichal Schmidt
When isolating, the JOB_STOP jobs have no parent job, so they are all peers of the real anchor job. This is a bit odd. Link them from the anchor job.
2012-04-20transaction: maintain anchor_jobMichal Schmidt
Track which job is the anchor in the transaction.
2012-04-20transaction: do not add installed jobs to the transactionMichal Schmidt
Do not attempt to optimize away the job creation by refering to installed jobs. We do not want to disturb installed jobs until commiting the transaction. (A later patch to job merging will make the separation of transaction jobs and installed jobs complete.)
2012-04-20job: jobs shouldn't need to know about transaction anchorsMichal Schmidt
Let the transactions maintain their own anchor links.
2012-04-20job: job_new() can find the manager from the unitMichal Schmidt
2012-04-20manager: split transaction.[ch]Michal Schmidt
manager.c takes care of the main loop, unit management, signal handling, ... transaction.c computes transactions. After split: manager.c: 65 KB transaction.c: 40 KB