From: Benjamin Marzinski <bmarzins@redhat.com>
To: Martin Wilck <martin.wilck@suse.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>,
Alice Frosi <afrosi@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Martin Wilck <mwilck@suse.com>,
dm-devel@lists.linux.dev
Subject: Re: [PATCH v3 04/10] libmpathutil: move systemd_listen_fds() support into multipathd
Date: Mon, 17 Feb 2025 17:55:01 -0500 [thread overview]
Message-ID: <Z7O-RUP9bv4h552T@redhat.com> (raw)
In-Reply-To: <20250214221011.136762-5-mwilck@suse.com>
On Fri, Feb 14, 2025 at 11:10:05PM +0100, Martin Wilck wrote:
> This feature is only used by multipathd.
We should probably move all of ux_socket_listen() to multipathd, since
it's only used there. But I see why you split out this code, and moving
ux_socket_listen() can happen whenever.
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
> libmpathutil/uxsock.c | 15 ---------------
> multipathd/main.c | 28 +++++++++++++++++++++++++++-
> 2 files changed, 27 insertions(+), 16 deletions(-)
>
> diff --git a/libmpathutil/uxsock.c b/libmpathutil/uxsock.c
> index 889d7a1..59c4717 100644
> --- a/libmpathutil/uxsock.c
> +++ b/libmpathutil/uxsock.c
> @@ -46,23 +46,8 @@ int ux_socket_listen(const char *name)
> {
> int fd;
> size_t len;
> -#ifdef USE_SYSTEMD
> - int num;
> -#endif
> struct sockaddr_un addr;
>
> -#ifdef USE_SYSTEMD
> - num = sd_listen_fds(0);
> - if (num > 1) {
> - condlog(3, "sd_listen_fds returned %d fds", num);
> - return -1;
> - } else if (num == 1) {
> - fd = SD_LISTEN_FDS_START + 0;
> - condlog(3, "using fd %d from sd_listen_fds", fd);
> - return fd;
> - }
> -#endif
> -
> /* This is after the PID check, so unlinking should be fine */
> if (name[0] != '@' && unlink(name) == -1 && errno != ENOENT)
> condlog(1, "Failed to unlink %s", name);
> diff --git a/multipathd/main.c b/multipathd/main.c
> index 52630f7..5455bdf 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -1863,15 +1863,41 @@ uevqloop (void * ap)
> pthread_cleanup_pop(1);
> return NULL;
> }
> +
> +#ifdef USE_SYSTEMD
> +static int get_systemd_sockets(long *ux_sock)
> +{
> + int num = sd_listen_fds(0);
> +
> + if (num > 1) {
> + condlog(3, "sd_listen_fds returned %d fds", num);
> + return -1;
> + } else if (num == 1) {
> + ux_sock[0] = SD_LISTEN_FDS_START + 0;
> + condlog(3, "using fd %ld from sd_listen_fds", ux_sock[0]);
> + }
> + return num;
> +}
> +#else
> +static int get_systemd_sockets(long *ux_sock __attribute__((unused)))
> +{
> + return 0;
> +}
> +#endif
> +
> +
> static void *
> uxlsnrloop (void * ap)
> {
> long ux_sock;
> + int num;
>
> pthread_cleanup_push(rcu_unregister, NULL);
> rcu_register_thread();
>
> - ux_sock = ux_socket_listen(DEFAULT_SOCKET);
> + num = get_systemd_sockets(&ux_sock);
> + if (num < 1)
> + ux_sock = ux_socket_listen(DEFAULT_SOCKET);
> if (ux_sock == -1) {
> condlog(1, "could not create uxsock: %d", errno);
> exit_daemon();
> --
> 2.48.1
next prev parent reply other threads:[~2025-02-17 22:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-14 22:10 [PATCH v3 00/10] multipath-tools: provide pathname and abstract sockets Martin Wilck
2025-02-14 22:10 ` [PATCH v3 01/10] multipath-tools: move DEFAULT_SOCKET definition into Makefile.inc Martin Wilck
2025-02-14 22:10 ` [PATCH v3 02/10] multipath-tools: add helper mpath_fill_sockaddr__() Martin Wilck
2025-02-17 22:52 ` Benjamin Marzinski
2025-02-14 22:10 ` [PATCH v3 03/10] libmpathutil: add support for Unix pathname sockets Martin Wilck
2025-02-14 22:10 ` [PATCH v3 04/10] libmpathutil: move systemd_listen_fds() support into multipathd Martin Wilck
2025-02-17 22:55 ` Benjamin Marzinski [this message]
2025-02-14 22:10 ` [PATCH v3 05/10] multipathd: make uxsock_listen() take a pointer to fd Martin Wilck
2025-02-14 22:10 ` [PATCH v3 06/10] multipathd: allow receiving two socket fds from systemd Martin Wilck
2025-02-14 22:10 ` [PATCH v3 07/10] multipathd: listen on pathname and abstract socket by default Martin Wilck
2025-02-14 22:10 ` [PATCH v3 08/10] libmpathcmd: try both abstract and pathname sockets Martin Wilck
2025-02-17 22:57 ` Benjamin Marzinski
2025-02-18 0:05 ` Martin Wilck
2025-02-14 22:10 ` [PATCH v3 09/10] libmpathcmd: honor MULTIPATH_SOCKET_NAME environment variable Martin Wilck
2025-02-14 22:10 ` [PATCH v3 10/10] multipathd: " Martin Wilck
2025-02-17 22:58 ` [PATCH v3 00/10] multipath-tools: provide pathname and abstract sockets Benjamin Marzinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z7O-RUP9bv4h552T@redhat.com \
--to=bmarzins@redhat.com \
--cc=afrosi@redhat.com \
--cc=christophe.varoqui@opensvc.com \
--cc=dm-devel@lists.linux.dev \
--cc=martin.wilck@suse.com \
--cc=mwilck@suse.com \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.