From: Steve Dickson <steved@redhat.com>
To: Alberto Garcia <berto@igalia.com>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH] systemd: Ensure that statdpath exists using systemd-tmpfiles
Date: Sat, 15 Jul 2023 16:53:02 -0400 [thread overview]
Message-ID: <5230337e-b028-0e86-9693-c29f7d1165b2@redhat.com> (raw)
In-Reply-To: <20230713102531.131072-1-berto@igalia.com>
Hello,
On 7/13/23 6:25 AM, Alberto Garcia wrote:
> The NFS utils store their state under /var/lib/nfs and they can
> generally handle the case where that directory is missing by creating
> the appropriate files and directories automatically.
>
> This is not the case of rpc-statd: if sm and sm.bak (under $statdpath,
> which also defaults to /var/lib/nfs) are missing the daemon will
> refuse to start and will exit with an error.
Why are they would be missing? They are created on the
nfs-utils installation.
>
> If nfs-utils is configured with systemd support it can take advantage
> of systemd-tmpfiles to ensure that the state directories are always
> present and have the appropriate ownership.
>
> This would normally be handled with the StateDirectory directive in
> rpc-statd.service, however that method would not be able to change the
> ownership of the directories to $statduser because this daemon needs
> to be run as root, and only later changes its uid and gid.
Just curious... how did you test this patch? When I apply it
I get this error
Failed to insert: creating /var/lib/nfs/statd/sm/<client>: Permission denied
STAT_FAIL to <server> for SM_MON of <server_ip>
Maybe this is packing issue but I'm thinking it is more
of systemd issue... the permissions on the sm directory
are
283 drwx------. 2 nobody rpcuser 6 Apr 18 20:00 /var/lib/nfs/statd/sm
instead of
283 drwx------. 2 rpcuser rpcuser 6 Apr 18 20:00 /var/lib/nfs/statd/sm
Even when I change the owner to rpcuser, I still get the
permission error...
steved.
>
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
> configure.ac | 1 +
> systemd/Makefile.am | 5 +++++
> systemd/nfs-utils.conf.in | 4 ++++
> 3 files changed, 10 insertions(+)
> create mode 100644 systemd/nfs-utils.conf.in
>
> diff --git a/configure.ac b/configure.ac
> index 6fbcb974..fe958ab3 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -695,6 +695,7 @@ AC_CONFIG_COMMANDS_PRE([eval eval _rpc_pipefsmount=$rpc_pipefsmount])
>
> AC_CONFIG_FILES([
> Makefile
> + systemd/nfs-utils.conf
> systemd/rpc-gssd.service
> systemd/rpc_pipefs.target
> systemd/var-lib-nfs-rpc_pipefs.mount
> diff --git a/systemd/Makefile.am b/systemd/Makefile.am
> index b4483222..6127986e 100644
> --- a/systemd/Makefile.am
> +++ b/systemd/Makefile.am
> @@ -5,6 +5,9 @@ MAINTAINERCLEANFILES = Makefile.in
> udev_rulesdir = /usr/lib/udev/rules.d/
> udev_files = 60-nfs.rules
>
> +sdtmpfilesdir = /usr/lib/tmpfiles.d/
> +sdtmpfiles_files = nfs-utils.conf
> +
> unit_files = \
> nfs-client.target \
> rpc_pipefs.target \
> @@ -85,4 +88,6 @@ install-data-hook: $(unit_files) $(udev_files)
> cp $(rpc_pipefs_mount_file) $(DESTDIR)/$(unitdir)/$(rpc_pipefsmount)
> mkdir -p $(DESTDIR)/$(udev_rulesdir)
> cp $(udev_files) $(DESTDIR)/$(udev_rulesdir)
> + mkdir -p $(DESTDIR)/$(sdtmpfilesdir)
> + cp $(sdtmpfiles_files) $(DESTDIR)/$(sdtmpfilesdir)
> endif
> diff --git a/systemd/nfs-utils.conf.in b/systemd/nfs-utils.conf.in
> new file mode 100644
> index 00000000..a44c337e
> --- /dev/null
> +++ b/systemd/nfs-utils.conf.in
> @@ -0,0 +1,4 @@
> +# This is a systemd-tmpfiles configuration file
> +# type path mode uid gid age argument
> +d @statdpath@/sm 0700 @statduser@ :root - -
> +d @statdpath@/sm.bak 0700 @statduser@ :root - -
next prev parent reply other threads:[~2023-07-15 20:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 10:25 [PATCH] systemd: Ensure that statdpath exists using systemd-tmpfiles Alberto Garcia
2023-07-15 20:53 ` Steve Dickson [this message]
2023-07-18 22:16 ` Alberto Garcia
2023-07-25 15:58 ` Steve Dickson
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=5230337e-b028-0e86-9693-c29f7d1165b2@redhat.com \
--to=steved@redhat.com \
--cc=berto@igalia.com \
--cc=linux-nfs@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).