From: Lennart Poettering Date: Wed, 12 Apr 2023 19:07:29 +0000 (+0200) Subject: pid1: add some debug logging when stashing ds into the fdstore X-Git-Tag: v254-rc1~736^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e8783d7620e4811738be078480aa5ffc9bbdcf9b;p=thirdparty%2Fsystemd.git pid1: add some debug logging when stashing ds into the fdstore --- diff --git a/src/core/service.c b/src/core/service.c index e59c5796276..1c31782fabb 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -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 */ }