diff options
author | Stefan Lendl <[email protected]> | 2024-01-12 21:05:11 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2024-01-29 14:53:29 -0800 |
commit | 4db88c37cc4ebcf0bb00ea9574cf66c9ccf2409c (patch) | |
tree | 93db8e02f54b8d50f36dc7bc09ff98be33a856a0 /cmd | |
parent | 8b1c6db3d2f35cf13c5f35374b0ec37216881ec7 (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.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index 5644869cf..67b191d72 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -7230,7 +7230,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 |