[systemd-commits] 2 commits - src/automount.c src/label.c src/label.h src/mount-setup.c src/service.c src/tmpfiles.c TODO

Lennart Poettering lennart at kemper.freedesktop.org
Thu Feb 24 16:49:17 PST 2011


 TODO              |    8 +++++++-
 src/automount.c   |    2 +-
 src/label.c       |    6 +++++-
 src/label.h       |    3 ++-
 src/mount-setup.c |    4 ++--
 src/service.c     |   18 +++++++++++++-----
 src/tmpfiles.c    |    2 +-
 7 files changed, 31 insertions(+), 12 deletions(-)

New commits:
commit 6d55002a69dea3b8d941c5c4e4fce80f371060b5
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 25 01:49:10 2011 +0100

    service: never clean up a service that still has a process in it

diff --git a/src/service.c b/src/service.c
index e928d1a..fef96e1 100644
--- a/src/service.c
+++ b/src/service.c
@@ -2496,16 +2496,26 @@ static const char *service_sub_state_to_string(Unit *u) {
         return service_state_to_string(SERVICE(u)->state);
 }
 
-#ifdef HAVE_SYSV_COMPAT
 static bool service_check_gc(Unit *u) {
         Service *s = SERVICE(u);
 
         assert(s);
 
-        return !!s->sysv_path;
-}
+        /* Never clean up services that still have a process around,
+         * even if the service is formally dead. */
+        if (cgroup_good(s) > 0 ||
+            main_pid_good(s) > 0 ||
+            control_pid_good(s) > 0)
+                return true;
+
+#ifdef HAVE_SYSV_COMPAT
+        if (s->sysv_path)
+                return true;
 #endif
 
+        return false;
+}
+
 static bool service_check_snapshot(Unit *u) {
         Service *s = SERVICE(u);
 
@@ -3317,9 +3327,7 @@ const UnitVTable service_vtable = {
         .active_state = service_active_state,
         .sub_state_to_string = service_sub_state_to_string,
 
-#ifdef HAVE_SYSV_COMPAT
         .check_gc = service_check_gc,
-#endif
         .check_snapshot = service_check_snapshot,
 
         .sigchld_event = service_sigchld_event,

commit c904f64d84db8c4eebedf210ba10893f19ba05ed
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 25 01:47:31 2011 +0100

    label: udev might be making changes in /dev while we iterate through it
    
    Also, there are most likely dead symlinks in there, so let's ignore
    ENOENT when we relabel.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=680169

diff --git a/TODO b/TODO
index 0f64307..b3c33ad 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,7 @@
 F15:
 
+* swap units that are activated by one name but shown in the kernel under another are semi-broken
+
 * dep cycle basic → udev-retry → auditd → iptables → basic
 
 * isolate multi-user.target doesn't start a getty at tty1 if we run it from graphical.target
@@ -19,7 +21,11 @@ F15:
 
 * Make systemd-cryptsetup cancellable
 
-* udev should be able to upgrade its database on its own
+* add fstab fields to add wait timeouts, change Wants to Requires by local-fs.target
+
+* hook emergency.target into local-fs.target in some way as OnFailure with isolate
+
+* convince Karel to give us our own mount option prefix
 
 Features:
 
diff --git a/src/automount.c b/src/automount.c
index 9447c0d..7289311 100644
--- a/src/automount.c
+++ b/src/automount.c
@@ -305,7 +305,7 @@ static int open_dev_autofs(Manager *m) {
         if (m->dev_autofs_fd >= 0)
                 return m->dev_autofs_fd;
 
-	label_fix("/dev/autofs");
+	label_fix("/dev/autofs", false);
 
         if ((m->dev_autofs_fd = open("/dev/autofs", O_CLOEXEC|O_RDONLY)) < 0) {
                 log_error("Failed to open /dev/autofs: %s", strerror(errno));
diff --git a/src/label.c b/src/label.c
index 218d0df..09ded64 100644
--- a/src/label.c
+++ b/src/label.c
@@ -65,7 +65,7 @@ int label_init(void) {
         return r;
 }
 
-int label_fix(const char *path) {
+int label_fix(const char *path, bool ignore_enoent) {
         int r = 0;
 
 #ifdef HAVE_SELINUX
@@ -90,6 +90,10 @@ int label_fix(const char *path) {
                         /* If the FS doesn't support labels, then exit without warning */
                         if (r < 0 && errno == ENOTSUP)
                                 return 0;
+
+                        /* Ignore ENOENT in some cases */
+                        if (r < 0 && ignore_enoent && errno == ENOENT)
+                                return 0;
                 }
         }
 
diff --git a/src/label.h b/src/label.h
index f1bf5d6..7ea11cd 100644
--- a/src/label.h
+++ b/src/label.h
@@ -23,11 +23,12 @@
 ***/
 
 #include <sys/types.h>
+#include <stdbool.h>
 
 int label_init(void);
 void label_finish(void);
 
-int label_fix(const char *path);
+int label_fix(const char *path, bool ignore_enoent);
 
 int label_socket_set(const char *label);
 void label_socket_clear(void);
diff --git a/src/mount-setup.c b/src/mount-setup.c
index 64fb476..5cbaee6 100644
--- a/src/mount-setup.c
+++ b/src/mount-setup.c
@@ -121,7 +121,7 @@ static int mount_one(const MountPoint *p) {
                 return p->fatal ? -errno : 0;
         }
 
-        label_fix(p->where);
+        label_fix(p->where, false);
 
         return 0;
 }
@@ -216,7 +216,7 @@ static int nftw_cb(
         if (ftwbuf->level == 0)
                 return 0;
 
-        label_fix(fpath);
+        label_fix(fpath, true);
         return 0;
 };
 
diff --git a/src/tmpfiles.c b/src/tmpfiles.c
index 917747a..0302262 100644
--- a/src/tmpfiles.c
+++ b/src/tmpfiles.c
@@ -507,7 +507,7 @@ static int create_item(Item *i) {
                 break;
         }
 
-        if ((r = label_fix(i->path)) < 0)
+        if ((r = label_fix(i->path, false)) < 0)
                 goto finish;
 
         log_debug("%s created successfully.", i->path);



More information about the systemd-commits mailing list