Fix nfs_truncate_shares without /etc/exports.d #15468
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 incmd/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 thenfs-kernel-server
package.The code for exports_available is copied from nfs_available above.
Fixes: ede037c
("Make zfs-share service resilient to stale exports")
Closes #15369
The commit adds a check for existence of
/etc/exports.d
, before trying to lock/etc/exports.d/zfs.exports.lock
.This prevents the printing of a warning message on
zfs mount -a
orzfs share -a
Motivation and Context
#15369
Description
How Has This Been Tested?
Compiled Proxmox utils and libs packages with the patch applied on top of ZFS-2.0.0 and verified that
zfs mount -a
does not print the warning anymoreTypes of changes
Checklist:
Signed-off-by
.