[systemd/f15] Pick a few fixes from upstream v37.

Michal Schmidt michich at fedoraproject.org
Wed Oct 12 01:10:52 UTC 2011


commit ee602f0dd7ce07ebd7af310c1d2741f8607beeb9
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Wed Oct 12 02:44:08 2011 +0200

    Pick a few fixes from upstream v37.
    
    Including the change to disable main PID guessing for SysV services.
    Loop over %{patches} in the spec.
    Fixes: BZ#718464, fdo#41336

 ...adahead-lower-max-file-size-for-readahead.patch |   26 ++++
 ...-t-try-to-guess-PID-for-SysV-services-any.patch |   32 +++++
 ...lization-do-not-try-to-compare-id-in-virt.patch |   23 +++
 0001-tmpfiles-fix-file-descriptor-leak.patch       |   25 ++++
 0001-units-forgot-target-units.patch               |   53 +++++++
 ...duce-local-fs-pre.target-and-remote-fs-pr.patch |  148 ++++++++++++++++++++
 ...nt-root-and-API-FS-before-all-mount-units.patch |   47 ++++++
 0001-util-fix-close-call-on-wrong-variable.patch   |   40 ++++++
 systemd.spec                                       |   89 +++---------
 9 files changed, 415 insertions(+), 68 deletions(-)
---
diff --git a/0001-readahead-lower-max-file-size-for-readahead.patch b/0001-readahead-lower-max-file-size-for-readahead.patch
new file mode 100644
index 0000000..eb0465e
--- /dev/null
+++ b/0001-readahead-lower-max-file-size-for-readahead.patch
@@ -0,0 +1,26 @@
+From 53273a6aefeb27f62c439e25f28c26859023c7df Mon Sep 17 00:00:00 2001
+From: Paolo Bonzini <bonzini at gnu.org>
+Date: Tue, 11 Oct 2011 01:43:58 +0200
+Subject: [PATCH] readahead: lower max file size for readahead
+
+https://bugs.freedesktop.org/show_bug.cgi?id=41336
+---
+ src/readahead-common.h |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/readahead-common.h b/src/readahead-common.h
+index 167df31..9547ad2 100644
+--- a/src/readahead-common.h
++++ b/src/readahead-common.h
+@@ -27,7 +27,7 @@
+ 
+ #include "macro.h"
+ 
+-#define READAHEAD_FILE_SIZE_MAX (128*1024*1024)
++#define READAHEAD_FILE_SIZE_MAX (10*1024*1024)
+ 
+ int file_verify(int fd, const char *fn, off_t file_size_max, struct stat *st);
+ 
+-- 
+1.7.4.4
+
diff --git a/0001-service-don-t-try-to-guess-PID-for-SysV-services-any.patch b/0001-service-don-t-try-to-guess-PID-for-SysV-services-any.patch
new file mode 100644
index 0000000..e5d8f27
--- /dev/null
+++ b/0001-service-don-t-try-to-guess-PID-for-SysV-services-any.patch
@@ -0,0 +1,32 @@
+From 1835f23c2a53e632959270e79dbf3143874e6111 Mon Sep 17 00:00:00 2001
+From: Lennart Poettering <lennart at poettering.net>
+Date: Tue, 11 Oct 2011 20:21:06 +0200
+Subject: [PATCH] service: don't try to guess PID for SysV services anymore
+
+As it turns out there are quite a number of SysV services too broken to
+make the guessing work: instead of returning in the parent only after
+the child is fully initialized they return immediately. The effect is
+that the guessing in systemd might happen too early, at a time where the
+final main process doesn't exist yet.
+
+By turning this off we won't try to detect the main pid anymore, with
+the effect that all processes of the service in question are considered
+equally likely to be the main process.
+---
+[ fixed reject -- michich ]
+
+ src/service.c |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+Index: systemd-26/src/service.c
+===================================================================
+--- systemd-26.orig/src/service.c
++++ systemd-26/src/service.c
+@@ -827,6 +827,7 @@ static int service_load_sysv_path(Servic
+         /* Special setting for all SysV services */
+         s->type = SERVICE_FORKING;
+         s->remain_after_exit = true;
++        s->guess_main_pid = false;
+         s->restart = SERVICE_RESTART_NO;
+ 
+         if (s->meta.manager->sysv_console)
diff --git a/0001-test_virtualization-do-not-try-to-compare-id-in-virt.patch b/0001-test_virtualization-do-not-try-to-compare-id-in-virt.patch
new file mode 100644
index 0000000..c99e4e4
--- /dev/null
+++ b/0001-test_virtualization-do-not-try-to-compare-id-in-virt.patch
@@ -0,0 +1,23 @@
+From e5396fed3f33cb80699561b55090dc3ba7c95de8 Mon Sep 17 00:00:00 2001
+From: Kay Sievers <kay.sievers at vrfy.org>
+Date: Sun, 9 Oct 2011 16:36:45 +0200
+Subject: [PATCH] test_virtualization: do not try to compare id in !virt
+ context
+
+---
+
+[ simple backport -- michich ]
+
+Index: systemd-26/src/condition.c
+===================================================================
+--- systemd-26.orig/src/condition.c
++++ systemd-26/src/condition.c
+@@ -129,7 +129,7 @@ static bool test_virtualization(const ch
+         if (r == 0 && b == 0)
+                 return true;
+ 
+-        return streq(parameter, id);
++        return r > 0 && streq(parameter, id);
+ }
+ 
+ static bool test_security(const char *parameter) {
diff --git a/0001-tmpfiles-fix-file-descriptor-leak.patch b/0001-tmpfiles-fix-file-descriptor-leak.patch
new file mode 100644
index 0000000..8e9a0b2
--- /dev/null
+++ b/0001-tmpfiles-fix-file-descriptor-leak.patch
@@ -0,0 +1,25 @@
+From 10d975f54c88223fb8762a226fd011ec3f30f2eb Mon Sep 17 00:00:00 2001
+From: Thomas Jarosch <thomas.jarosch at intra2net.com>
+Date: Wed, 5 Oct 2011 22:30:49 +0200
+Subject: [PATCH] tmpfiles: fix file descriptor leak
+
+Detected by "cppcheck"
+---
+ src/tmpfiles.c |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+diff --git a/src/tmpfiles.c b/src/tmpfiles.c
+index a6b8f85..21bf44d 100644
+--- a/src/tmpfiles.c
++++ b/src/tmpfiles.c
+@@ -157,6 +157,7 @@ static void load_unix_sockets(void) {
+                 }
+         }
+ 
++        fclose(f);
+         return;
+ 
+ fail:
+-- 
+1.7.4.4
+
diff --git a/0001-units-forgot-target-units.patch b/0001-units-forgot-target-units.patch
new file mode 100644
index 0000000..44de512
--- /dev/null
+++ b/0001-units-forgot-target-units.patch
@@ -0,0 +1,53 @@
+From 822b18599d1c9465449c7111fe7e7b86fbf44a57 Mon Sep 17 00:00:00 2001
+From: Lennart Poettering <lennart at poettering.net>
+Date: Tue, 11 Oct 2011 14:26:20 +0200
+Subject: [PATCH] units: forgot target units
+
+---
+ units/local-fs-pre.target  |   11 +++++++++++
+ units/remote-fs-pre.target |   15 +++++++++++++++
+ 2 files changed, 26 insertions(+), 0 deletions(-)
+ create mode 100644 units/local-fs-pre.target
+ create mode 100644 units/remote-fs-pre.target
+
+diff --git a/units/local-fs-pre.target b/units/local-fs-pre.target
+new file mode 100644
+index 0000000..11e67ba
+--- /dev/null
++++ b/units/local-fs-pre.target
+@@ -0,0 +1,11 @@
++#  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=Local File Systems (Pre)
+diff --git a/units/remote-fs-pre.target b/units/remote-fs-pre.target
+new file mode 100644
+index 0000000..5406aa2
+--- /dev/null
++++ b/units/remote-fs-pre.target
+@@ -0,0 +1,15 @@
++#  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=Remote File Systems (Pre)
++After=network.target
++
++[Install]
++WantedBy=multi-user.target
+-- 
+1.7.4.4
+
diff --git a/0001-units-introduce-local-fs-pre.target-and-remote-fs-pr.patch b/0001-units-introduce-local-fs-pre.target-and-remote-fs-pr.patch
new file mode 100644
index 0000000..2dfd7b9
--- /dev/null
+++ b/0001-units-introduce-local-fs-pre.target-and-remote-fs-pr.patch
@@ -0,0 +1,148 @@
+From 21e557edcc1894ce4eeb70b71ca16e82e95bc0df Mon Sep 17 00:00:00 2001
+From: Lennart Poettering <lennart at poettering.net>
+Date: Tue, 11 Oct 2011 03:33:53 +0200
+Subject: [PATCH] units: introduce local-fs-pre.target and
+ remote-fs-pre.target
+
+This hook target enables services to order themselves between
+network.target and remote mounts, which is needed for GFS2 and similar
+systems.
+---
+
+[ patching Makefile.in too to avoid the need for autotools -- michich ]
+
+ Makefile.am                |    2 ++
+ Makefile.in                |    4 +++-
+ man/systemd.special.xml.in |   26 ++++++++++++++++++++++++++
+ src/mount.c                |    6 ++++--
+ src/special.h              |    2 ++
+ 5 files changed, 37 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 873090e..26fc1f8 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -237,6 +237,8 @@ dist_systemunit_DATA = \
+ 	units/halt.target \
+ 	units/kexec.target \
+ 	units/local-fs.target \
++	units/local-fs-pre.target \
++	units/remote-fs-pre.target \
+ 	units/cryptsetup.target \
+ 	units/network.target \
+ 	units/nss-lookup.target \
+diff --git a/Makefile.in b/Makefile.in
+index 9897e73..611c392 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -845,7 +845,8 @@ am__dist_systemunit_DATA_DIST = units/graphical.target \
+ 	units/multi-user.target units/emergency.service \
+ 	units/emergency.target units/sysinit.target units/basic.target \
+ 	units/getty.target units/halt.target units/kexec.target \
+-	units/local-fs.target units/cryptsetup.target \
++	units/local-fs.target units/local-fs-pre.target \
++	units/remote-fs-pre.target units/cryptsetup.target \
+ 	units/network.target units/nss-lookup.target \
+ 	units/mail-transfer-agent.target units/http-daemon.target \
+ 	units/poweroff.target units/reboot.target units/rescue.target \
+@@ -1135,6 +1136,7 @@ dist_systemunit_DATA = units/graphical.target units/multi-user.target \
+ 	units/emergency.service units/emergency.target \
+ 	units/sysinit.target units/basic.target units/getty.target \
+ 	units/halt.target units/kexec.target units/local-fs.target \
++	units/local-fs-pre.target units/remote-fs-pre.target \
+ 	units/cryptsetup.target units/network.target \
+ 	units/nss-lookup.target units/mail-transfer-agent.target \
+ 	units/http-daemon.target units/poweroff.target \
+diff --git a/man/systemd.special.xml.in b/man/systemd.special.xml.in
+index ecc9dde..24f2d65 100644
+--- a/man/systemd.special.xml.in
++++ b/man/systemd.special.xml.in
+@@ -59,6 +59,7 @@
+                 <filename>halt.target</filename>,
+                 <filename>kbrequest.target</filename>,
+                 <filename>local-fs.target</filename>,
++                <filename>local-fs-pre.target</filename>,
+                 <filename>mail-transfer-agent.target</filename>,
+                 <filename>multi-user.target</filename>,
+                 <filename>network.target</filename>,
+@@ -66,6 +67,7 @@
+                 <filename>poweroff.target</filename>,
+                 <filename>reboot.target</filename>,
+                 <filename>remote-fs.target</filename>,
++                <filename>remote-fs-pre.target</filename>,
+                 <filename>rescue.target</filename>,
+                 <filename>rpcbind.target</filename>,
+                 <filename>time-sync.target</filename>,
+@@ -261,6 +263,18 @@
+                                 </listitem>
+                         </varlistentry>
+                         <varlistentry>
++                                <term><filename>local-fs-pre.target</filename></term>
++                                <listitem>
++                                        <para>This target unit is
++                                        automatically ordered before
++                                        all local mount points marked
++                                        with <option>auto</option>
++                                        (see above). It can be used to
++                                        execute certain units before
++                                        all local mounts.</para>
++                                </listitem>
++                        </varlistentry>
++                        <varlistentry>
+                                 <term><filename>mail-transfer-agent.target</filename></term>
+                                 <listitem>
+                                         <para>The mail transfer agent
+@@ -374,6 +388,18 @@
+                                 </listitem>
+                         </varlistentry>
+                         <varlistentry>
++                                <term><filename>remote-fs-pre.target</filename></term>
++                                <listitem>
++                                        <para>This target unit is
++                                        automatically ordered before
++                                        all remote mount points marked
++                                        with <option>auto</option>
++                                        (see above). It can be used to
++                                        execute certain units before
++                                        all remote mounts.</para>
++                                </listitem>
++                        </varlistentry>
++                        <varlistentry>
+                                 <term><filename>rescue.target</filename></term>
+                                 <listitem>
+                                         <para>A special target unit
+diff --git a/src/mount.c b/src/mount.c
+index 11b6e83..1a9505e 100644
+--- a/src/mount.c
++++ b/src/mount.c
+@@ -357,9 +357,11 @@ static int mount_add_fstab_links(Mount *m) {
+ 
+         if (mount_is_network(p)) {
+                 target = SPECIAL_REMOTE_FS_TARGET;
+-                after = SPECIAL_NETWORK_TARGET;
+-        } else
++                after = SPECIAL_REMOTE_FS_PRE_TARGET;
++        } else {
+                 target = SPECIAL_LOCAL_FS_TARGET;
++                after = SPECIAL_LOCAL_FS_PRE_TARGET;
++        }
+ 
+         if (!path_equal(m->where, "/"))
+                 if ((r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true)) < 0)
+diff --git a/src/special.h b/src/special.h
+index 08dae11..703559b 100644
+--- a/src/special.h
++++ b/src/special.h
+@@ -45,7 +45,9 @@
+ #define SPECIAL_SYSINIT_TARGET "sysinit.target"
+ #define SPECIAL_SOCKETS_TARGET "sockets.target"
+ #define SPECIAL_LOCAL_FS_TARGET "local-fs.target"         /* LSB's $local_fs */
++#define SPECIAL_LOCAL_FS_PRE_TARGET "local-fs-pre.target"
+ #define SPECIAL_REMOTE_FS_TARGET "remote-fs.target"       /* LSB's $remote_fs */
++#define SPECIAL_REMOTE_FS_PRE_TARGET "remote-fs-pre.target"
+ #define SPECIAL_SWAP_TARGET "swap.target"
+ #define SPECIAL_BASIC_TARGET "basic.target"
+ 
+-- 
+1.7.4.4
+
diff --git a/0001-units-remount-root-and-API-FS-before-all-mount-units.patch b/0001-units-remount-root-and-API-FS-before-all-mount-units.patch
new file mode 100644
index 0000000..80ff4ec
--- /dev/null
+++ b/0001-units-remount-root-and-API-FS-before-all-mount-units.patch
@@ -0,0 +1,47 @@
+From 8266f984df0b069a345bf959628bac70877ce5e1 Mon Sep 17 00:00:00 2001
+From: Lennart Poettering <lennart at poettering.net>
+Date: Tue, 11 Oct 2011 03:41:04 +0200
+Subject: [PATCH] units: remount root and API FS before all mount units are
+ applied
+
+In order to ensure that bind mounts copy the final mount settings to the
+new bind mount make the root and API FS mount options are applied before
+the other file systems are mounted.
+
+https://bugzilla.redhat.com/show_bug.cgi?id=718464
+---
+ units/remount-rootfs.service             |    3 ++-
+ units/systemd-remount-api-vfs.service.in |    3 ++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/units/remount-rootfs.service b/units/remount-rootfs.service
+index e95023f..89a16c8 100644
+--- a/units/remount-rootfs.service
++++ b/units/remount-rootfs.service
+@@ -10,7 +10,8 @@ Description=Remount Root FS
+ DefaultDependencies=no
+ Conflicts=shutdown.target
+ After=systemd-readahead-collect.service systemd-readahead-replay.service fsck-root.service
+-Before=local-fs.target shutdown.target
++Before=local-fs-pre.target local-fs.target shutdown.target
++Wants=local-fs-pre.target
+ 
+ [Service]
+ Type=oneshot
+diff --git a/units/systemd-remount-api-vfs.service.in b/units/systemd-remount-api-vfs.service.in
+index 2ccbe23..6339ee6 100644
+--- a/units/systemd-remount-api-vfs.service.in
++++ b/units/systemd-remount-api-vfs.service.in
+@@ -10,7 +10,8 @@ Description=Remount API VFS
+ DefaultDependencies=no
+ Conflicts=shutdown.target
+ After=systemd-readahead-collect.service systemd-readahead-replay.service
+-Before=local-fs.target shutdown.target
++Before=local-fs-pre.target local-fs.target shutdown.target
++Wants=local-fs-pre.target
+ 
+ [Service]
+ Type=oneshot
+-- 
+1.7.4.4
+
diff --git a/0001-util-fix-close-call-on-wrong-variable.patch b/0001-util-fix-close-call-on-wrong-variable.patch
new file mode 100644
index 0000000..1e46393
--- /dev/null
+++ b/0001-util-fix-close-call-on-wrong-variable.patch
@@ -0,0 +1,40 @@
+From 678abaf91e2308f02fb679c2dc2679a3b6a5b8be Mon Sep 17 00:00:00 2001
+From: Thomas Jarosch <thomas.jarosch at intra2net.com>
+Date: Wed, 5 Oct 2011 22:31:41 +0200
+Subject: [PATCH] util: fix close() call on wrong variable
+
+Detected by "cppcheck" (actually it detected a file descriptor leak)
+---
+ src/util.c |    9 ++++++---
+ 1 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/src/util.c b/src/util.c
+index 7977ee4..e46606d 100644
+--- a/src/util.c
++++ b/src/util.c
+@@ -2307,8 +2307,10 @@ int chvt(int vt) {
+                         0
+                 };
+ 
+-                if (ioctl(fd, TIOCLINUX, tiocl) < 0)
+-                        return -errno;
++                if (ioctl(fd, TIOCLINUX, tiocl) < 0) {
++                        r = -errno;
++                        goto fail;
++                }
+ 
+                 vt = tiocl[0] <= 0 ? 1 : tiocl[0];
+         }
+@@ -2316,7 +2318,8 @@ int chvt(int vt) {
+         if (ioctl(fd, VT_ACTIVATE, vt) < 0)
+                 r = -errno;
+ 
+-        close_nointr_nofail(r);
++fail:
++        close_nointr_nofail(fd);
+         return r;
+ }
+ 
+-- 
+1.7.4.4
+
diff --git a/systemd.spec b/systemd.spec
index 728b360..0fcaa55 100644
--- a/systemd.spec
+++ b/systemd.spec
@@ -2,7 +2,7 @@ Name:           systemd
 Url:            http://www.freedesktop.org/wiki/Software/systemd
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Version:        26
-Release:        10%{?dist}
+Release:        11%{?dist}
 License:        GPLv2+
 Group:          System Environment/Base
 Summary:        A System and Service Manager
@@ -105,6 +105,14 @@ Patch63:        0001-llvm-analyze-fix-some-bugs-found-by-llvm-analyze.patch
 # May be risky. See what it caused in F16 in bz741078.
 #Patch64:        0001-unit-fix-complementing-of-requirement-deps-with-Afte.patch
 Patch65:        0001-service-fix-up-std-output-error-before-we-add-depend.patch
+Patch66:        0001-test_virtualization-do-not-try-to-compare-id-in-virt.patch
+Patch67:        0001-tmpfiles-fix-file-descriptor-leak.patch
+Patch68:        0001-util-fix-close-call-on-wrong-variable.patch
+Patch69:        0001-readahead-lower-max-file-size-for-readahead.patch
+Patch70:        0001-units-introduce-local-fs-pre.target-and-remote-fs-pr.patch
+Patch71:        0001-units-forgot-target-units.patch
+Patch72:        0001-units-remount-root-and-API-FS-before-all-mount-units.patch
+Patch73:        0001-service-don-t-try-to-guess-PID-for-SysV-services-any.patch
 Patch100:       fedora-storage-detect-encrypted-PVs.patch
 
 # For sysvinit tools
@@ -159,73 +167,12 @@ SysV compatibility tools for systemd
 
 %prep
 %setup -q
-%patch0 -p1
-%patch1 -p1
-%patch2 -p1
-%patch3 -p1
-%patch4 -p1
-%patch5 -p1
-%patch6 -p1
-%patch7 -p1
-%patch8 -p1
-%patch9 -p1
-%patch10 -p1
-%patch11 -p1
-%patch12 -p1
-%patch13 -p1
-%patch14 -p1
-%patch15 -p1
-%patch16 -p1
-%patch17 -p1
-%patch18 -p1
-%patch19 -p1
-%patch20 -p1
-%patch21 -p1
-%patch22 -p1
-%patch23 -p1
-%patch24 -p1
-%patch25 -p1
-#% patch26 -p1
-%patch27 -p1
-%patch28 -p1
-%patch29 -p1
-%patch30 -p1
-%patch31 -p1
-%patch32 -p1
-%patch33 -p1
-%patch34 -p1
-%patch35 -p1
-%patch36 -p1
-#% patch37 -p1
-%patch38 -p1
-%patch39 -p1
-%patch40 -p1
-%patch41 -p1
-%patch42 -p1
-%patch43 -p1
-%patch44 -p1
-%patch45 -p1
-%patch46 -p1
-%patch47 -p1
-%patch48 -p1
-%patch49 -p1
-%patch50 -p1
-%patch51 -p1
-%patch52 -p1
-%patch53 -p1
-%patch54 -p1
-%patch55 -p1
-%patch56 -p1
-%patch57 -p1
-%patch58 -p1
-%patch59 -p1
-%patch60 -p1
-%patch61 -p1
-%patch62 -p1
-%patch63 -p1
-#% patch64 -p1
-%patch65 -p1
-%patch100 -p1
+set +x
+for p in %{patches}; do
+        echo "Applying $p"
+        patch -p1 < $p
+done
+set -x
 
 %build
 %configure --with-rootdir= --with-distro=fedora
@@ -428,6 +375,12 @@ fi
 %{_bindir}/systemd-sysv-convert
 
 %changelog
+* Wed Oct 12 2011 Michal Schmidt <mschmidt at redhat.com> - 26-11
+- Pick a few fixes from upstream v37.
+- Including the change to disable main PID guessing for SysV services.
+- Loop over %%{patches} in the spec.
+- Fixes: BZ#718464, fdo#41336
+
 * Sun Sep 25 2011 Michal Schmidt <mschmidt at redhat.com> - 26-10
 - Pick lots of fixes from upstream up to v36.
 - A few features added too:


More information about the scm-commits mailing list