From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id EA68E9E9D6 for ; Thu, 2 Nov 2023 18:34:15 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BEF491435D for ; Thu, 2 Nov 2023 18:33:45 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 2 Nov 2023 18:33:42 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id CAD6443E42 for ; Thu, 2 Nov 2023 18:33:41 +0100 (CET) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com Date: Thu, 2 Nov 2023 18:33:21 +0100 Message-Id: <20231102173321.748877-1-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.091 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Subject: [pve-devel] [PATCH zfsonlinux] add patch for spurious warning on `zfs mount -a` X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Nov 2023 17:34:16 -0000 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 --- 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 +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 +Reviewed-by: Brian Behlendorf +Signed-off-by: Stoiko Ivanov +Closes #15369 +Closes #15468 +(cherry picked from commit 41e55b476bcfc90f1ad81c02c5375367fdace9e9) +Signed-off-by: Stoiko Ivanov +--- + 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