From: Sebastien Buisson Date: Thu, 25 Apr 2024 16:42:44 +0000 (+0200) Subject: LU-17741 gss: fix lsvcgss service for systemd X-Git-Tag: 2.15.64~211 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=c6878334a1a73cef379e26bc985acf3302e35146;p=fs%2Flustre-release.git LU-17741 gss: fix lsvcgss service for systemd Add a systemd unit file for lsvcgss service, so that the lsvcgssd daemon can be handled correctly via systemctl. Test-Parameters: trivial Test-Parameters: kerberos=true testlist=sanity-krb5 clientdistro=el9.3 serverdistro=el9.3 Signed-off-by: Sebastien Buisson Change-Id: I7581996e1e28567415da0827681841ac228ad6c5 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54915 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Jian Yu Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre.spec.in b/lustre.spec.in index 3a99758..bb64629 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -774,6 +774,7 @@ echo '%{_sysconfdir}/ha.d/resource.d/Lustre' >>lustre.files # systemd is on redhat, fedora, and suse %if %{with systemd} echo '%{_unitdir}/lnet.service' >>lustre.files +echo '%{_unitdir}/lsvcgss.service' >>lustre.files %endif %if "%{_vendor}" == "redhat" || 0%{?openEuler} @@ -892,6 +893,7 @@ echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files %{_bindir}/lustre_req_history %{_bindir}/remove_changelog %{_bindir}/remove_updatelog +%{_bindir}/lsvcgss_sysd %endif %{_bindir}/llobdstat @@ -1000,16 +1002,19 @@ echo '%{_libdir}/lustre/tests/lutf/*' >>lustre-tests.files %post %if %{with systemd} %systemd_post lnet.service +%systemd_post lsvcgss.service %endif %preun %if %{with systemd} %systemd_preun lnet.service +%systemd_preun lsvcgss.service %endif %postun %if %{with systemd} %systemd_postun_with_restart lnet.service +%systemd_postun_with_restart lsvcgss.service %endif %clean diff --git a/lustre/scripts/Makefile.am b/lustre/scripts/Makefile.am index 1c1a1096..5f33af4 100644 --- a/lustre/scripts/Makefile.am +++ b/lustre/scripts/Makefile.am @@ -60,7 +60,8 @@ bin_SCRIPTS = lfs_migrate if SERVER sbin_SCRIPTS += $(genscripts) lc_mon lhbadm lc_servip -bin_SCRIPTS += lustre_req_history remove_changelog remove_updatelog +bin_SCRIPTS += lustre_req_history remove_changelog remove_updatelog \ + lsvcgss_sysd hadir = $(sysconfdir)/ha.d/resource.d ha_SCRIPTS = Lustre.ha_v2 @@ -95,7 +96,7 @@ EXTRA_DIST = lustre_rmmod ldev lc_mon lhbadm \ zfsobj2fid ko2iblnd-probe ksocklnd-config statechange-lustre.sh \ vdev_attach-lustre.sh vdev_remove-lustre.sh vdev_clear-lustre.sh \ bash-completion/lustre bash-completion/lctl bash-completion/lfs \ - remove_changelog remove_updatelog + remove_changelog remove_updatelog lsvcgss_sysd CLEANFILES = $(genscripts) diff --git a/lustre/scripts/lsvcgss_sysd b/lustre/scripts/lsvcgss_sysd new file mode 100644 index 0000000..0eec92a --- /dev/null +++ b/lustre/scripts/lsvcgss_sysd @@ -0,0 +1,22 @@ +#!/bin/bash +# +# lsvcgss Lustre GSS daemon +# + +# Must be identical to what lsvcgss.service uses +PIDFILE=/var/run/lsvcgss.pid + +# If service is not configured, launch with all mechs +# -k -- Enable kerberos support +# -s -- Enable shared key support +# -z -- Enable gssnull support +LSVCGSSDARGS="-k -s -z" + +# Check for and source configuration file +[ -f /etc/sysconfig/lsvcgss ] && . /etc/sysconfig/lsvcgss + +/usr/sbin/lsvcgssd ${LSVCGSSDARGS} +RETVAL=$? +[ $RETVAL -eq 0 ] && echo $(pidof lsvcgssd) > $PIDFILE + +exit $RETVAL diff --git a/lustre/scripts/systemd/Makefile.am b/lustre/scripts/systemd/Makefile.am index 340f6f1..18700c6 100644 --- a/lustre/scripts/systemd/Makefile.am +++ b/lustre/scripts/systemd/Makefile.am @@ -3,9 +3,10 @@ genunitfiles = lnet.service if HAVE_SYSTEMD systemdsystemunit_DATA = lnet.service +systemdsystemunit_SCRIPTS = lsvcgss.service endif -EXTRA_DIST = $(addsuffix .in,$(genunitfiles)) +EXTRA_DIST = $(addsuffix .in,$(genunitfiles)) lsvcgss.service CLEANFILES = $(genunitfiles) diff --git a/lustre/scripts/systemd/lsvcgss.service b/lustre/scripts/systemd/lsvcgss.service new file mode 100644 index 0000000..d4996ba --- /dev/null +++ b/lustre/scripts/systemd/lsvcgss.service @@ -0,0 +1,8 @@ +[Unit] +Description=Lustre GSS daemon + +[Service] +Type=forking +ExecStart=/usr/bin/lsvcgss_sysd +ExecReload=/bin/kill -HUP $MAINPID +PIDFile=/var/run/lsvcgss.pid diff --git a/lustre/utils/gss/svcgssd.c b/lustre/utils/gss/svcgssd.c index 18c36ae..a2c69fc 100644 --- a/lustre/utils/gss/svcgssd.c +++ b/lustre/utils/gss/svcgssd.c @@ -178,7 +178,10 @@ sig_die(int signal) /* remove socket */ unlink(GSS_SOCKET_PATH); printerr(LL_WARN, "exiting on signal %d\n", signal); - exit(1); + if (signal == SIGTERM) + exit(EXIT_SUCCESS); + else + exit(EXIT_FAILURE); } static void