Skip to content
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

Fix volmode=none property behavior at import time #6426

Merged
merged 1 commit into from
Jul 31, 2017

Conversation

loli10K
Copy link
Contributor

@loli10K loli10K commented Jul 29, 2017

Description

At import time spa_import() calls zvol_create_minors() directly: with the current implementation we have no way to avoid device node creation when volmode=none.

Fix this by enforcing volmode=none directly in zvol_alloc().

Motivation and Context

I encountered this issue importing an old USB disk used to backup virtual machines: i set volmode=none on the root dataset but subsequent imports were still creating device nodes.

How Has This Been Tested?

I've updated the ZTS script tests/functional/zvol/zvol_misc/zvol_misc_volmode.ksh

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.
  • All new and existing tests passed.
  • All commit messages are properly formatted and contain Signed-off-by.
  • Change has been approved by a ZFS on Linux member.

At import time spa_import() calls zvol_create_minors() directly: with
the current implementation we have no way to avoid device node
creation when volmode=none.

Fix this by enforcing volmode=none directly in zvol_alloc().

Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
@loli10K loli10K force-pushed the fix-zvol-volmode-import branch from e38a104 to 91b6116 Compare July 30, 2017 06:43
@@ -3425,7 +3425,7 @@ function swap_setup
typeset swapdev=$1

if is_linux; then
log_must mkswap $swapdev > /dev/null 2>&1
log_must eval "mkswap $swapdev > /dev/null 2>&1"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the eval we can't see the message logged by log_must:

Test: /usr/share/zfs/zfs-tests/tests/functional/zvol/zvol_swap/setup (run as root) [00:03] [PASS]
22:00:26.22 SUCCESS: zpool create -f testpool loop0
22:00:26.25 SUCCESS: zfs create -V 256m testpool/testvol
Test: /usr/share/zfs/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_001_pos (run as root) [00:00] [FAIL]
22:00:29.38 ASSERTION: Verify that a zvol can be used as a swap device
22:00:29.38 NOTE: Add zvol volume as swap space
Test: /usr/share/zfs/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_002_pos (run as root) [00:00] [FAIL]
22:00:29.47 ASSERTION: Using a zvol as swap space, fill /var/tmp to 80%.
Test: /usr/share/zfs/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_003_pos (run as root) [00:00] [SKIP]
22:00:29.56 Modifies global non-ZFS system config
Test: /usr/share/zfs/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_004_pos (run as root) [00:03] [FAIL]
22:00:29.58 ASSERTION: For an added swap zvol, (2G <= volsize <= 16G)
22:00:29.60 SUCCESS: zfs create -s -b 8192 -V 262144 testpool/vol_262144
Test: /usr/share/zfs/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_005_pos (run as root) [00:00] [SKIP]
22:00:32.88 swaplow + swaplen unsupported Linux options
Test: /usr/share/zfs/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap_006_pos (run as root) [00:00] [SKIP]
22:00:32.90 swaplow + swaplen unsupported Linux options
Test: /usr/share/zfs/zfs-tests/tests/functional/zvol/zvol_swap/cleanup (run as root) [00:00] [PASS]

@behlendorf behlendorf merged commit c7a7601 into openzfs:master Jul 31, 2017
tonyhutter pushed a commit to tonyhutter/zfs that referenced this pull request Jul 31, 2017
At import time spa_import() calls zvol_create_minors() directly: with
the current implementation we have no way to avoid device node
creation when volmode=none.

Fix this by enforcing volmode=none directly in zvol_alloc().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes openzfs#6426
tonyhutter pushed a commit that referenced this pull request Aug 2, 2017
At import time spa_import() calls zvol_create_minors() directly: with
the current implementation we have no way to avoid device node
creation when volmode=none.

Fix this by enforcing volmode=none directly in zvol_alloc().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #6426
@loli10K loli10K deleted the fix-zvol-volmode-import branch August 3, 2017 17:59
Fabian-Gruenbichler pushed a commit to Fabian-Gruenbichler/zfs that referenced this pull request Sep 6, 2017
At import time spa_import() calls zvol_create_minors() directly: with
the current implementation we have no way to avoid device node
creation when volmode=none.

Fix this by enforcing volmode=none directly in zvol_alloc().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes openzfs#6426
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants