]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pid1: add some debug logging when stashing ds into the fdstore
authorLennart Poettering <lennart@poettering.net>
Wed, 12 Apr 2023 19:07:29 +0000 (21:07 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 13 Apr 2023 04:44:27 +0000 (06:44 +0200)
src/core/service.c

index e59c5796276097c8e084c7afa10bc76b14d7af95..1c31782fabbc6681a361569579a0df11b1cfef97 100644 (file)
@@ -481,6 +481,7 @@ static int on_fd_store_io(sd_event_source *e, int fd, uint32_t revents, void *us
 }
 
 static int service_add_fd_store(Service *s, int fd, const char *name, bool do_poll) {
+        struct stat st;
         ServiceFDStore *fs;
         int r;
 
@@ -489,16 +490,22 @@ static int service_add_fd_store(Service *s, int fd, const char *name, bool do_po
         assert(s);
         assert(fd >= 0);
 
+        if (fstat(fd, &st) < 0)
+                return -errno;
+
+        log_unit_debug(UNIT(s), "Trying to stash fd for dev=" DEVNUM_FORMAT_STR "/inode=%" PRIu64, DEVNUM_FORMAT_VAL(st.st_dev), (uint64_t) st.st_ino);
+
         if (s->n_fd_store >= s->n_fd_store_max)
-                return -EXFULL; /* Our store is full.
-                                 * Use this errno rather than E[NM]FILE to distinguish from
-                                 * the case where systemd itself hits the file limit. */
+                /* Our store is full.  Use this errno rather than E[NM]FILE to distinguish from the case
+                 * where systemd itself hits the file limit. */
+                return log_unit_debug_errno(UNIT(s), SYNTHETIC_ERRNO(EXFULL), "Hit fd store limit.");
 
         LIST_FOREACH(fd_store, i, s->fd_store) {
                 r = same_fd(i->fd, fd);
                 if (r < 0)
                         return r;
                 if (r > 0) {
+                        log_unit_debug(UNIT(s), "Suppressing duplicate fd in fd store.");
                         asynchronous_close(fd);
                         return 0; /* fd already included */
                 }