* [pve-devel] [PATCH zfsonlinux] add patch for spurious warning on `zfs mount -a`
@ 2023-11-02 17:33 Stoiko Ivanov
2023-11-02 19:12 ` [pve-devel] applied: " Thomas Lamprecht
2023-11-02 19:13 ` Thomas Lamprecht
0 siblings, 2 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2023-11-02 17:33 UTC (permalink / raw)
To: pve-devel
reported in our community forum:
https://forum.proxmox.com/threads/.135635/post-60036
the small fix was merged upstream:
https://github.com/openzfs/zfs/pull/15468
minimally tested by building with this patch and running
`zfs mount -a` on an affected system.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
this patch fixes a cosmetic issue, but might help keep support requests down
a bit.
also quickly skimmed through the other patches in upstream/master and
salsa.debian.org - but currently don't think anything needs to be pulled in
urgently
...runcate_shares-without-etc-exports.d.patch | 76 +++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 77 insertions(+)
create mode 100644 debian/patches/0012-Fix-nfs_truncate_shares-without-etc-exports.d.patch
diff --git a/debian/patches/0012-Fix-nfs_truncate_shares-without-etc-exports.d.patch b/debian/patches/0012-Fix-nfs_truncate_shares-without-etc-exports.d.patch
new file mode 100644
index 00000000..7eb9721d
--- /dev/null
+++ b/debian/patches/0012-Fix-nfs_truncate_shares-without-etc-exports.d.patch
@@ -0,0 +1,76 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: siv0 <github@nomore.at>
+Date: Tue, 31 Oct 2023 21:57:54 +0100
+Subject: [PATCH] Fix nfs_truncate_shares without /etc/exports.d
+
+Calling nfs_reset_shares on Linux prints a warning:
+`failed to lock /etc/exports.d/zfs.exports.lock: No such file or
+directory`
+when /etc/exports.d does not exist. The directory gets created, when a
+filesystem is actually exported through nfs_toggle_share and
+nfs_init_share. The truncation of /etc/exports.d/zfs.exports happens
+unconditionally when calling `zfs mount -a` (via zfs_do_mount and
+share_mount in `cmd/zfs/zfs_main.c`).
+
+Fixing the issue only in the Linux part, since the exports file on
+freebsd is in `/etc/zfs/`, which seems present on 2 FreeBSD systems I
+have access to (through `/etc/zfs/compatibility.d/`), while a Debian
+box does not have the directory even if `/usr/sbin/exportfs` is
+present through the `nfs-kernel-server` package.
+
+The code for exports_available is copied from nfs_available above.
+
+Fixes: ede037cda73675f42b1452187e8dd3438fafc220
+("Make zfs-share service resilient to stale exports")
+
+Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
+Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
+Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
+Closes #15369
+Closes #15468
+(cherry picked from commit 41e55b476bcfc90f1ad81c02c5375367fdace9e9)
+Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
+---
+ lib/libshare/os/linux/nfs.c | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/lib/libshare/os/linux/nfs.c b/lib/libshare/os/linux/nfs.c
+index 004946b0c..3dce81840 100644
+--- a/lib/libshare/os/linux/nfs.c
++++ b/lib/libshare/os/linux/nfs.c
+@@ -47,6 +47,7 @@
+
+
+ static boolean_t nfs_available(void);
++static boolean_t exports_available(void);
+
+ typedef int (*nfs_shareopt_callback_t)(const char *opt, const char *value,
+ void *cookie);
+@@ -539,6 +540,8 @@ nfs_commit_shares(void)
+ static void
+ nfs_truncate_shares(void)
+ {
++ if (!exports_available())
++ return;
+ nfs_reset_shares(ZFS_EXPORTS_LOCK, ZFS_EXPORTS_FILE);
+ }
+
+@@ -566,3 +569,18 @@ nfs_available(void)
+
+ return (avail == 1);
+ }
++
++static boolean_t
++exports_available(void)
++{
++ static int avail;
++
++ if (!avail) {
++ if (access(ZFS_EXPORTS_DIR, F_OK) != 0)
++ avail = -1;
++ else
++ avail = 1;
++ }
++
++ return (avail == 1);
++}
diff --git a/debian/patches/series b/debian/patches/series
index 710cbfbe..6a5ab10f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,3 +9,4 @@
0009-arc-stat-summary-guard-access-to-l2arc-MFU-MRU-stats.patch
0010-zvol-Remove-broken-blk-mq-optimization.patch
0011-Revert-zvol-Temporally-disable-blk-mq.patch
+0012-Fix-nfs_truncate_shares-without-etc-exports.d.patch
--
2.39.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] applied: [PATCH zfsonlinux] add patch for spurious warning on `zfs mount -a`
2023-11-02 17:33 [pve-devel] [PATCH zfsonlinux] add patch for spurious warning on `zfs mount -a` Stoiko Ivanov
@ 2023-11-02 19:12 ` Thomas Lamprecht
2023-11-02 19:13 ` Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2023-11-02 19:12 UTC (permalink / raw)
To: Proxmox VE development discussion, Stoiko Ivanov
On 02/11/2023 18:33, Stoiko Ivanov wrote:
> reported in our community forum:
> https://forum.proxmox.com/threads/.135635/post-60036
>
> the small fix was merged upstream:
> https://github.com/openzfs/zfs/pull/15468
>
> minimally tested by building with this patch and running
> `zfs mount -a` on an affected system.
>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> this patch fixes a cosmetic issue, but might help keep support requests down
> a bit.
> also quickly skimmed through the other patches in upstream/master and
> salsa.debian.org - but currently don't think anything needs to be pulled in
> urgently
>
> ...runcate_shares-without-etc-exports.d.patch | 76 +++++++++++++++++++
> debian/patches/series | 1 +
> 2 files changed, 77 insertions(+)
> create mode 100644 debian/patches/0012-Fix-nfs_truncate_shares-without-etc-exports.d.patch
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] applied: [PATCH zfsonlinux] add patch for spurious warning on `zfs mount -a`
2023-11-02 17:33 [pve-devel] [PATCH zfsonlinux] add patch for spurious warning on `zfs mount -a` Stoiko Ivanov
2023-11-02 19:12 ` [pve-devel] applied: " Thomas Lamprecht
@ 2023-11-02 19:13 ` Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2023-11-02 19:13 UTC (permalink / raw)
To: Proxmox VE development discussion, Stoiko Ivanov
On 02/11/2023 18:33, Stoiko Ivanov wrote:
> reported in our community forum:
> https://forum.proxmox.com/threads/.135635/post-60036
The dot isn't required, but it seems the anchor # really is,
your link goes to an ancient post without that, switched it
to:
https://forum.proxmox.com/threads/135635/#post-60036
>
> the small fix was merged upstream:
> https://github.com/openzfs/zfs/pull/15468
>
> minimally tested by building with this patch and running
> `zfs mount -a` on an affected system.
>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> this patch fixes a cosmetic issue, but might help keep support requests down
> a bit.
> also quickly skimmed through the other patches in upstream/master and
> salsa.debian.org - but currently don't think anything needs to be pulled in
> urgently
>
> ...runcate_shares-without-etc-exports.d.patch | 76 +++++++++++++++++++
> debian/patches/series | 1 +
> 2 files changed, 77 insertions(+)
> create mode 100644 debian/patches/0012-Fix-nfs_truncate_shares-without-etc-exports.d.patch
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-02 19:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-02 17:33 [pve-devel] [PATCH zfsonlinux] add patch for spurious warning on `zfs mount -a` Stoiko Ivanov
2023-11-02 19:12 ` [pve-devel] applied: " Thomas Lamprecht
2023-11-02 19:13 ` Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox