[systemd-commits] 2 commits - src/automount.c src/path.c src/socket.c src/timer.c units/emergency.service units/emergency.target units/fedora units/multi-user.target.m4 units/rescue.target
Lennart Poettering
lennart at kemper.freedesktop.org
Mon Jul 12 15:27:36 PDT 2010
src/automount.c | 7 +++++++
src/path.c | 4 ++++
src/socket.c | 7 +++++++
src/timer.c | 4 ++++
units/emergency.service | 1 -
units/emergency.target | 4 ++--
units/fedora/halt.service | 3 +--
units/fedora/poweroff.service | 3 +--
units/fedora/reboot.service | 3 +--
units/fedora/single.service | 3 ++-
units/fedora/sysinit.service | 3 ++-
units/multi-user.target.m4 | 2 +-
units/rescue.target | 5 ++---
13 files changed, 34 insertions(+), 15 deletions(-)
New commits:
commit ba3e67a78564bf25c5af97ffe2e1a122b193a9cb
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Jul 13 00:27:27 2010 +0200
socket: when the socket is supposed to stop, don't accept any connections anymore
diff --git a/src/automount.c b/src/automount.c
index 00f3736..e685c96 100644
--- a/src/automount.c
+++ b/src/automount.c
@@ -568,6 +568,13 @@ static void automount_enter_runnning(Automount *a) {
dbus_error_init(&error);
+ /* We don't take mount requests anymore if we are supposed to
+ * shut down anyway */
+ if (a->meta.job && a->meta.job->type == JOB_STOP) {
+ automount_send_ready(a, -EHOSTDOWN);
+ return;
+ }
+
mkdir_p(a->where, a->directory_mode);
/* Before we do anything, let's see if somebody is playing games with us? */
diff --git a/src/path.c b/src/path.c
index 27c4544..2ae6e56 100644
--- a/src/path.c
+++ b/src/path.c
@@ -304,6 +304,10 @@ static void path_enter_running(Path *p) {
assert(p);
dbus_error_init(&error);
+ /* Don't start job if we are supposed to go down */
+ if (p->meta.job && p->meta.job->type == JOB_STOP)
+ return;
+
if ((r = manager_add_job(p->meta.manager, JOB_START, p->unit, JOB_REPLACE, true, &error, NULL)) < 0)
goto fail;
diff --git a/src/socket.c b/src/socket.c
index 2d113ae..f998cad 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -1030,6 +1030,13 @@ static void socket_enter_running(Socket *s, int cfd) {
assert(s);
dbus_error_init(&error);
+ /* We don't take connections anymore if we are supposed to
+ * shut down anyway */
+ if (s->meta.job && s->meta.job->type == JOB_STOP) {
+ close_nointr_nofail(cfd);
+ return;
+ }
+
if (cfd < 0) {
if ((r = manager_add_job(s->meta.manager, JOB_START, UNIT(s->service), JOB_REPLACE, true, &error, NULL)) < 0)
goto fail;
diff --git a/src/timer.c b/src/timer.c
index 1c7010d..0d4ed27 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -268,6 +268,10 @@ static void timer_enter_running(Timer *t) {
assert(t);
dbus_error_init(&error);
+ /* Don't start job if we are supposed to go down */
+ if (t->meta.job && t->meta.job->type == JOB_STOP)
+ return;
+
if ((r = manager_add_job(t->meta.manager, JOB_START, t->unit, JOB_REPLACE, true, &error, NULL)) < 0)
goto fail;
commit a974d58e83e409a92ca916bb9bbce0e457ea896f
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Jul 13 00:19:17 2010 +0200
units: rely only on isolate to remove running services when entering rescue/emergency modes
diff --git a/units/emergency.service b/units/emergency.service
index a5a54bc..dd4a070 100644
--- a/units/emergency.service
+++ b/units/emergency.service
@@ -10,7 +10,6 @@
[Unit]
Description=Emergency Shell
DefaultDependencies=no
-After=shutdown.target
[Service]
ExecStartPre=-/bin/plymouth --hide-splash
diff --git a/units/emergency.target b/units/emergency.target
index 63924ea..5bf2ae2 100644
--- a/units/emergency.target
+++ b/units/emergency.target
@@ -9,5 +9,5 @@
[Unit]
Description=Emergency Mode
-Requires=shutdown.target umount.target emergency.service
-After=shutdown.target umount.target emergency.service
+Requires=emergency.service
+After=emergency.service
diff --git a/units/fedora/halt.service b/units/fedora/halt.service
index 4fe0d53..cf9ad49 100644
--- a/units/fedora/halt.service
+++ b/units/fedora/halt.service
@@ -9,8 +9,7 @@
Description=Halt
DefaultDependencies=no
Requires=shutdown.target umount.target killall.service
-Conflicts=sysinit.service
-After=shutdown.target umount.target killall.service sysinit.service
+After=shutdown.target umount.target killall.service
[Service]
Type=finish
diff --git a/units/fedora/poweroff.service b/units/fedora/poweroff.service
index 3a53875..e8b597c 100644
--- a/units/fedora/poweroff.service
+++ b/units/fedora/poweroff.service
@@ -9,8 +9,7 @@
Description=Power-Off
DefaultDependencies=no
Requires=shutdown.target umount.target killall.service
-Conflicts=sysinit.service
-After=shutdown.target umount.target killall.service sysinit.service
+After=shutdown.target umount.target killall.service
[Service]
Type=finish
diff --git a/units/fedora/reboot.service b/units/fedora/reboot.service
index 0f3e206..7a94db6 100644
--- a/units/fedora/reboot.service
+++ b/units/fedora/reboot.service
@@ -9,8 +9,7 @@
Description=Reboot
DefaultDependencies=no
Requires=shutdown.target umount.target killall.service
-Conflicts=sysinit.service
-After=shutdown.target umount.target killall.service sysinit.service
+After=shutdown.target umount.target killall.service
[Service]
Type=finish
diff --git a/units/fedora/single.service b/units/fedora/single.service
index 27f3578..be30efc 100644
--- a/units/fedora/single.service
+++ b/units/fedora/single.service
@@ -10,7 +10,8 @@
[Unit]
Description=Rescue Shell
DefaultDependencies=no
-After=shutdown.target sysinit.target
+Conflicts=multi-user.target
+After=sysinit.target multi-user.target
[Service]
ExecStartPre=-/bin/plymouth --hide-splash
diff --git a/units/fedora/sysinit.service b/units/fedora/sysinit.service
index 21872e8..0c25bd2 100644
--- a/units/fedora/sysinit.service
+++ b/units/fedora/sysinit.service
@@ -8,7 +8,8 @@
[Unit]
Description=System Initialization
DefaultDependencies=no
-Before=emergency.service emergency.target
+Conflicts=shutdown.target
+Before=shutdown.target emergency.service emergency.target
[Service]
ExecStart=/etc/rc.d/rc.sysinit
diff --git a/units/multi-user.target.m4 b/units/multi-user.target.m4
index 323ba01..2029297 100644
--- a/units/multi-user.target.m4
+++ b/units/multi-user.target.m4
@@ -10,7 +10,7 @@
[Unit]
Description=Multi-User
Requires=basic.target
-Conflicts=rescue.target shutdown.target
+Conflicts=rescue.target
After=basic.target rescue.target
m4_dnl
m4_ifdef(`TARGET_FEDORA',
diff --git a/units/rescue.target b/units/rescue.target
index 638f47c..2694856 100644
--- a/units/rescue.target
+++ b/units/rescue.target
@@ -9,9 +9,8 @@
[Unit]
Description=Rescue Mode
-Requires=sysinit.target local-fs.target swap.target shutdown.target
-Conflicts=emergency.service emergency.target
-After=sysinit.target local-fs.target swap.target shutdown.target emergency.service emergency.target
+Requires=sysinit.target local-fs.target swap.target
+After=sysinit.target local-fs.target swap.target
Names=runlevel1.target
[Install]
More information about the systemd-commits
mailing list