aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorStefan Lendl <[email protected]>2024-01-12 21:05:11 +0100
committerGitHub <[email protected]>2024-01-12 12:05:11 -0800
commit66670ba9f0f2ee04794f20628be28c46858badc7 (patch)
tree4addec4a6c1e58e0846065c1280789d960ae01f0 /cmd
parentc4fa674367776a8ced56df64d56a8797ed2cba48 (diff)
fix(mount): do not truncate shares not zfs mount
When running zfs share -a resetting the exports.d/zfs.exports makes sense the get a clean state. Truncating was also called with zfs mount which would not populate the file again. Add test to verify shares persist after mount -a. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Stefan Lendl <[email protected]> Closes #15607 Closes #15660
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zfs/zfs_main.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c
index 9939f206a..f67f6114d 100644
--- a/cmd/zfs/zfs_main.c
+++ b/cmd/zfs/zfs_main.c
@@ -7234,7 +7234,8 @@ share_mount(int op, int argc, char **argv)
pthread_mutex_init(&share_mount_state.sm_lock, NULL);
/* For a 'zfs share -a' operation start with a clean slate. */
- zfs_truncate_shares(NULL);
+ if (op == OP_SHARE)
+ zfs_truncate_shares(NULL);
/*
* libshare isn't mt-safe, so only do the operation in parallel