[systemd-commits] 3 commits - Makefile.am src/cgroup-util.c src/cryptsetup-generator.c TODO units/cryptsetup.target
Lennart Poettering
lennart at kemper.freedesktop.org
Wed Nov 17 17:38:57 PST 2010
Makefile.am | 7 +++++--
TODO | 4 +---
src/cgroup-util.c | 21 +++++++++++++--------
src/cryptsetup-generator.c | 21 ++++++++++++++++++++-
units/cryptsetup.target | 14 ++++++++++++++
5 files changed, 53 insertions(+), 14 deletions(-)
New commits:
commit 9f4527411bbba4c36d27509879d0340a546600ce
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Nov 18 02:37:35 2010 +0100
cgroup: after killing cgroup processes, ensure the group is really dead gone. wait for 3s at max
diff --git a/src/cgroup-util.c b/src/cgroup-util.c
index ccc94f8..4cf184a 100644
--- a/src/cgroup-util.c
+++ b/src/cgroup-util.c
@@ -321,16 +321,17 @@ int cg_kill_recursive_and_wait(const char *controller, const char *path, bool re
assert(controller);
/* This safely kills all processes; first it sends a SIGTERM,
- * then checks 8 times after 50ms whether the group is
- * now empty, and finally kills everything that is left with
- * SIGKILL */
+ * then checks 8 times after 200ms whether the group is now
+ * empty, then kills everything that is left with SIGKILL and
+ * finally checks 5 times after 200ms each whether the group
+ * is finally empty. */
- for (i = 0; i < 10; i++) {
+ for (i = 0; i < 15; i++) {
int sig, r;
if (i <= 0)
sig = SIGTERM;
- else if (i >= 9)
+ else if (i == 9)
sig = SIGKILL;
else
sig = 0;
@@ -338,7 +339,7 @@ int cg_kill_recursive_and_wait(const char *controller, const char *path, bool re
if ((r = cg_kill_recursive(controller, path, sig, true, rem, NULL)) <= 0)
return r;
- usleep(50 * USEC_PER_MSEC);
+ usleep(200 * USEC_PER_MSEC);
}
return 0;
commit 2db9ecac35f9f18b9cd76e5026c31c5eb015ac8c
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Nov 18 02:36:51 2010 +0100
cgroup: if we couldn't remove a cgroup after killing evertyhing in it then it's fine
diff --git a/src/cgroup-util.c b/src/cgroup-util.c
index 2167cdd..ccc94f8 100644
--- a/src/cgroup-util.c
+++ b/src/cgroup-util.c
@@ -298,7 +298,9 @@ int cg_kill_recursive(const char *controller, const char *path, int sig, bool ig
if (rem)
if ((r = cg_rmdir(controller, path)) < 0) {
- if (ret >= 0 && r != -ENOENT)
+ if (ret >= 0 &&
+ r != -ENOENT &&
+ r != -EBUSY)
ret = r;
}
@@ -459,7 +461,9 @@ int cg_migrate_recursive(const char *controller, const char *from, const char *t
if (rem)
if ((r = cg_rmdir(controller, from)) < 0) {
- if (ret >= 0 && r != -ENOENT)
+ if (ret >= 0 &&
+ r != -ENOENT &&
+ r != -EBUSY)
ret = r;
}
commit 2f8cd170aeb0d748f5af3cefb387d14f67fc286e
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Nov 18 02:16:36 2010 +0100
cryptsetup: automatically order crypt partitions before cryptsetup.target
diff --git a/Makefile.am b/Makefile.am
index 8cc2530..bc7ea9d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -188,6 +188,7 @@ dist_systemunit_DATA = \
units/halt.target \
units/kexec.target \
units/local-fs.target \
+ units/cryptsetup.target \
units/network.target \
units/nss-lookup.target \
units/mail-transfer-agent.target \
@@ -1161,12 +1162,14 @@ install-data-hook:
fsck-root.service \
remount-rootfs.service \
var-run.mount \
- var-lock.mount && \
+ var-lock.mount \
+ cryptsetup.target && \
$(LN_S) ../systemd-remount-api-vfs.service systemd-remount-api-vfs.service && \
$(LN_S) ../fsck-root.service fsck-root.service && \
$(LN_S) ../remount-rootfs.service remount-rootfs.service && \
$(LN_S) ../var-run.mount var-run.mount && \
- $(LN_S) ../var-lock.mount var-lock.mount )
+ $(LN_S) ../var-lock.mount var-lock.mount && \
+ $(LN_S) ../cryptsetup.target )
( cd $(DESTDIR)$(userunitdir) && \
rm -f shutdown.target sockets.target local-fs.target swap.target bluetooth.target printer.target && \
$(LN_S) $(systemunitdir)/shutdown.target shutdown.target && \
diff --git a/TODO b/TODO
index 260ce45..37833a2 100644
--- a/TODO
+++ b/TODO
@@ -88,12 +88,10 @@
* add to cpu cgroup by default
-* introduce crypttab.target
+External:
* make cryptsetup lower --iter-time
-External:
-
* patch kernel for xattr support in /dev, /proc/, /sys and /sys/fs/cgroup.
* patch kernel for cpu feature modalias for autoloading aes/kvm/...
diff --git a/src/cryptsetup-generator.c b/src/cryptsetup-generator.c
index a2b398d..c5e54d0 100644
--- a/src/cryptsetup-generator.c
+++ b/src/cryptsetup-generator.c
@@ -102,7 +102,7 @@ static int create_disk(
"DefaultDependencies=no\n"
"BindTo=%s dev-mapper-%%i.device\n"
"After=systemd-readahead-collect.service systemd-readahead-replay.service %s\n"
- "Before=dev-mapper-%%i.device shutdown.target local-fs.target\n",
+ "Before=dev-mapper-%%i.device shutdown.target cryptsetup.target\n",
d, d);
if (password && (streq(password, "/dev/urandom") ||
@@ -157,6 +157,25 @@ static int create_disk(
r = -errno;
goto fail;
}
+
+ free(to);
+ to = NULL;
+
+ if (!options || !has_option(options, "nofail")) {
+
+ if (asprintf(&to, "%s/cryptsetup.target.wants/%s", arg_dest, n) < 0) {
+ r = -ENOMEM;
+ goto fail;
+ }
+
+ mkdir_parents(to, 0755);
+
+ if (symlink(from, to) < 0) {
+ log_error("Failed to create symlink '%s' to '%s': %m", from, to);
+ r = -errno;
+ goto fail;
+ }
+ }
}
free(to);
diff --git a/units/cryptsetup.target b/units/cryptsetup.target
new file mode 100644
index 0000000..9e4db78
--- /dev/null
+++ b/units/cryptsetup.target
@@ -0,0 +1,14 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# See systemd.special(7) for details
+
+[Unit]
+Description=Encrypted Volumes
+
+[Install]
+WantedBy=local-fs.target
More information about the systemd-commits
mailing list