[arch-commits] Commit in systemd/trunk (3 files)
Dave Reisner
dreisner at nymeria.archlinux.org
Mon Sep 16 19:06:28 UTC 2013
Date: Monday, September 16, 2013 @ 21:06:28
Author: dreisner
Revision: 194482
upgpkg: systemd 207-2
- backport fixes for auto swap activation
Added:
systemd/trunk/0001-swap-fix-reverse-dependencies.patch
systemd/trunk/0002-swap-create-.wants-symlink-to-auto-swap-devices.patch
Modified:
systemd/trunk/PKGBUILD
------------------------------------------------------------+
0001-swap-fix-reverse-dependencies.patch | 30 +++
0002-swap-create-.wants-symlink-to-auto-swap-devices.patch | 90 +++++++++++
PKGBUILD | 17 +-
3 files changed, 134 insertions(+), 3 deletions(-)
Added: 0001-swap-fix-reverse-dependencies.patch
===================================================================
--- 0001-swap-fix-reverse-dependencies.patch (rev 0)
+++ 0001-swap-fix-reverse-dependencies.patch 2013-09-16 19:06:28 UTC (rev 194482)
@@ -0,0 +1,30 @@
+From 90060fa6605446bef7078867423b691e4effa575 Mon Sep 17 00:00:00 2001
+From: Tom Gundersen <teg at jklm.no>
+Date: Fri, 13 Sep 2013 14:46:18 +0200
+Subject: [PATCH] swap: fix reverse dependencies
+
+Make sure swap.target correctly requires/wants the swap units.
+
+This fixes https://bugs.freedesktop.org/show_bug.cgi?id=69291.
+
+Reported-by: Hussam Al-Tayeb
+---
+ src/core/swap.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/core/swap.c b/src/core/swap.c
+index 57d15eb..3950860 100644
+--- a/src/core/swap.c
++++ b/src/core/swap.c
+@@ -220,7 +220,7 @@ static int swap_add_default_dependencies(Swap *s) {
+ }
+
+ if (!noauto) {
+- r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, (nofail ? UNIT_WANTED_BY : UNIT_REQUIRED_BY),
++ r = unit_add_two_dependencies_by_name_inverse(UNIT(s), UNIT_AFTER, (nofail ? UNIT_WANTS : UNIT_REQUIRES),
+ SPECIAL_SWAP_TARGET, NULL, true);
+ if (r < 0)
+ return r;
+--
+1.8.4
+
Added: 0002-swap-create-.wants-symlink-to-auto-swap-devices.patch
===================================================================
--- 0002-swap-create-.wants-symlink-to-auto-swap-devices.patch (rev 0)
+++ 0002-swap-create-.wants-symlink-to-auto-swap-devices.patch 2013-09-16 19:06:28 UTC (rev 194482)
@@ -0,0 +1,90 @@
+From 4e82fe5213bedcb70e25c0270e516d5f2706d8c8 Mon Sep 17 00:00:00 2001
+From: Tom Gundersen <teg at jklm.no>
+Date: Mon, 16 Sep 2013 01:08:32 +0200
+Subject: [PATCH] swap: create .wants symlink to 'auto' swap devices
+
+As we load unit files lazily, we need to make sure something pulls in swap
+units that should be started automatically, otherwise the default dependencies
+will never be applied.
+
+This partially reinstates code removed in
+commit 64347fc2b983f33e7efb0fd2bb44e133fb9f30f4.
+
+Also don't order swap devices after swap.target when they are 'nofail'.
+---
+ src/core/swap.c | 8 ++++++--
+ src/fstab-generator/fstab-generator.c | 18 ++++++++++++++++--
+ 2 files changed, 22 insertions(+), 4 deletions(-)
+
+diff --git a/src/core/swap.c b/src/core/swap.c
+index 3950860..76c7d45 100644
+--- a/src/core/swap.c
++++ b/src/core/swap.c
+@@ -220,8 +220,12 @@ static int swap_add_default_dependencies(Swap *s) {
+ }
+
+ if (!noauto) {
+- r = unit_add_two_dependencies_by_name_inverse(UNIT(s), UNIT_AFTER, (nofail ? UNIT_WANTS : UNIT_REQUIRES),
+- SPECIAL_SWAP_TARGET, NULL, true);
++ if (nofail)
++ r = unit_add_dependency_by_name_inverse(UNIT(s),
++ UNIT_WANTS, SPECIAL_SWAP_TARGET, NULL, true);
++ else
++ r = unit_add_two_dependencies_by_name_inverse(UNIT(s),
++ UNIT_AFTER, UNIT_REQUIRES, SPECIAL_SWAP_TARGET, NULL, true);
+ if (r < 0)
+ return r;
+ }
+diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
+index 6ebe8aa..b73dfa4 100644
+--- a/src/fstab-generator/fstab-generator.c
++++ b/src/fstab-generator/fstab-generator.c
+@@ -66,6 +66,7 @@ static int mount_find_pri(struct mntent *me, int *ret) {
+ static int add_swap(const char *what, struct mntent *me) {
+ _cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL;
+ _cleanup_fclose_ FILE *f = NULL;
++ bool noauto;
+ int r, pri = -1;
+
+ assert(what);
+@@ -77,6 +78,8 @@ static int add_swap(const char *what, struct mntent *me) {
+ return pri;
+ }
+
++ noauto = !!hasmntopt(me, "noauto");
++
+ name = unit_name_from_path(what, ".swap");
+ if (!name)
+ return log_oom();
+@@ -97,8 +100,7 @@ static int add_swap(const char *what, struct mntent *me) {
+ fprintf(f,
+ "# Automatically generated by systemd-fstab-generator\n\n"
+ "[Unit]\n"
+- "SourcePath=/etc/fstab\n"
+- "\n"
++ "SourcePath=/etc/fstab\n\n"
+ "[Swap]\n"
+ "What=%s\n",
+ what);
+@@ -114,6 +116,18 @@ static int add_swap(const char *what, struct mntent *me) {
+ return -errno;
+ }
+
++ if (!noauto) {
++ lnk = strjoin(arg_dest, "/" SPECIAL_SWAP_TARGET ".wants/", name, NULL);
++ if (!lnk)
++ return log_oom();
++
++ mkdir_parents_label(lnk, 0755);
++ if (symlink(unit, lnk) < 0) {
++ log_error("Failed to create symlink %s: %m", lnk);
++ return -errno;
++ }
++ }
++
+ return 0;
+ }
+
+--
+1.8.4
+
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2013-09-16 18:34:43 UTC (rev 194481)
+++ PKGBUILD 2013-09-16 19:06:28 UTC (rev 194482)
@@ -4,7 +4,7 @@
pkgbase=systemd
pkgname=('systemd' 'systemd-sysvcompat')
pkgver=207
-pkgrel=1
+pkgrel=2
arch=('i686' 'x86_64')
url="http://www.freedesktop.org/wiki/Software/systemd"
makedepends=('acl' 'cryptsetup' 'dbus-core' 'docbook-xsl' 'gobject-introspection' 'gperf'
@@ -14,12 +14,23 @@
source=("http://www.freedesktop.org/software/$pkgname/$pkgname-$pkgver.tar.xz"
'initcpio-hook-udev'
'initcpio-install-systemd'
- 'initcpio-install-udev')
+ 'initcpio-install-udev'
+ 0001-swap-fix-reverse-dependencies.patch
+ 0002-swap-create-.wants-symlink-to-auto-swap-devices.patch)
md5sums=('7799f3cc9d289b8db1c1fa56ae7ecd88'
'2de72238ed5c0df62a7c3b6bdaf8cb7c'
'9027b31a875e74a45623954b3b23d09f'
- 'd83d45e67cd75cdbafb81c96a7485319')
+ 'd83d45e67cd75cdbafb81c96a7485319'
+ '182be4c729aaecde249b7b05b48a481f'
+ 'b54fbe35e2689ac36cda9ac4a5a86f24')
+prepare() {
+ cd "$pkgname-$pkgver"
+
+ patch -Np1 <"$srcdir"/0001-swap-fix-reverse-dependencies.patch
+ patch -Np1 <"$srcdir"/0002-swap-create-.wants-symlink-to-auto-swap-devices.patch
+}
+
build() {
cd "$pkgname-$pkgver"
More information about the arch-commits
mailing list