Skip to content

'zfs share -a' should clean noauto exports #10747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 20, 2020
Merged

'zfs share -a' should clean noauto exports #10747

merged 2 commits into from
Aug 20, 2020

Conversation

don-brady
Copy link
Contributor

Motivation and Context

This is a follow on to PR-10688 where zfs share -a allows the sharing of canmount=noauto datasets if they are mounted.
However, when a dataset with canmount=noauto is not mounted, the command should also purge any existing entries from the exports file. Otherwise, after a reboot, the nfs server attempts to export the underlying mountpath, not the dataset. This can lead to a hard hang for existing client mounts.

Reference: https://access.redhat.com/solutions/3540591

Description

Instead of just skipping the adding of an export if not mounted and canmount=noauto, have it also remove an existing export of the dataset so that, after a reboot, we don't export an unmounted dataset.

How Has This Been Tested?

ZTS - functional/cli_root/zfs_share/zfs_share_012_pos.ksh (new test to verify behavior)

Also tested in our internal testing workflows that was previously causing a hard hang

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the contributing document.
  • I have added tests to cover my changes.
  • I have run the ZFS Test Suite with this change applied.
  • All commit messages are properly formatted and contain Signed-off-by.

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Aug 20, 2020
@codecov
Copy link

codecov bot commented Aug 20, 2020

Codecov Report

Merging #10747 into master will decrease coverage by 0.15%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10747      +/-   ##
==========================================
- Coverage   79.70%   79.54%   -0.16%     
==========================================
  Files         394      394              
  Lines      124638   124640       +2     
==========================================
- Hits        99342    99145     -197     
- Misses      25296    25495     +199     
Flag Coverage Δ
#kernel 80.30% <ø> (-0.07%) ⬇️
#user 65.11% <100.00%> (-0.85%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/zfs/zfs_main.c 82.86% <100.00%> (+0.06%) ⬆️
module/zfs/vdev_rebuild.c 93.69% <0.00%> (-3.48%) ⬇️
module/zfs/vdev_raidz.c 88.88% <0.00%> (-2.62%) ⬇️
module/zfs/dsl_synctask.c 92.40% <0.00%> (-2.54%) ⬇️
lib/libzfs/libzfs_changelist.c 84.26% <0.00%> (-1.88%) ⬇️
module/zfs/lzjb.c 98.14% <0.00%> (-1.86%) ⬇️
cmd/zed/agents/fmd_api.c 88.61% <0.00%> (-1.78%) ⬇️
module/zfs/metaslab.c 94.35% <0.00%> (-1.49%) ⬇️
module/os/linux/zfs/vdev_disk.c 84.04% <0.00%> (-1.17%) ⬇️
cmd/zed/agents/zfs_diagnosis.c 77.55% <0.00%> (-1.17%) ⬇️
... and 46 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 716b53d...ea7fe34. Read the comment docs.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Aug 20, 2020
@behlendorf behlendorf merged commit 7bba1d4 into openzfs:master Aug 20, 2020
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
This is a follow on to PR openzfs#10688 where `zfs share -a` allows the 
sharing of canmount=noauto datasets if they are mounted.  However, 
when a dataset with canmount=noauto is not mounted, the command 
should also purge any existing entries from the exports file. 
Otherwise, after a reboot, the nfs server attempts to export the 
underlying mountpath, not the dataset. This can lead to a hard hang 
for existing client mounts.

Instead of just skipping the adding of an export if not mounted 
and canmount=noauto, have it also remove an existing export of the 
dataset so that, after a reboot, we don't export an unmounted dataset.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: George Wilson <[email protected]>
Signed-off-by: Don Brady <[email protected]>
Closes openzfs#10747
sempervictus pushed a commit to sempervictus/zfs that referenced this pull request May 31, 2021
This is a follow on to PR openzfs#10688 where `zfs share -a` allows the 
sharing of canmount=noauto datasets if they are mounted.  However, 
when a dataset with canmount=noauto is not mounted, the command 
should also purge any existing entries from the exports file. 
Otherwise, after a reboot, the nfs server attempts to export the 
underlying mountpath, not the dataset. This can lead to a hard hang 
for existing client mounts.

Instead of just skipping the adding of an export if not mounted 
and canmount=noauto, have it also remove an existing export of the 
dataset so that, after a reboot, we don't export an unmounted dataset.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: George Wilson <[email protected]>
Signed-off-by: Don Brady <[email protected]>
Closes openzfs#10747
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants