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

Add ashift validation when adding devices to a pool #15509

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

grwilson
Copy link
Member

@grwilson grwilson commented Nov 9, 2023

Currently, zpool add allows users to add top-level vdevs that have different ashifts but doing so prevents users from being able to perform a top-level vdev removal. Often times consumers may not realize that they have mismatched ashifts until the top-level removal fails.

This feature adds ashift validation to the zpool add command and will fail the operation if the sector size of the specified vdev does not match the existing pool. In addition a new flag, -a, is added to the command to disable the ashift validation checks.

@grwilson grwilson added the Status: Code Review Needed Ready for review and testing label Nov 9, 2023
@grwilson grwilson force-pushed the ashift_validate branch 2 times, most recently from d66a627 to 91cd782 Compare November 10, 2023 17:49
cmd/zpool/zpool_main.c Outdated Show resolved Hide resolved
cmd/zpool/zpool_main.c Outdated Show resolved Hide resolved
@grwilson grwilson force-pushed the ashift_validate branch 3 times, most recently from 64fd09b to 6e09ec9 Compare February 27, 2024 13:35
cmd/zpool/zpool_main.c Show resolved Hide resolved
module/zfs/spa.c Show resolved Hide resolved
include/libzfs.h Outdated Show resolved Hide resolved
lib/libzfs/libzfs_pool.c Outdated Show resolved Hide resolved
cmd/zpool/zpool_main.c Show resolved Hide resolved
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Mar 8, 2024
@grwilson
Copy link
Member Author

grwilson commented Mar 8, 2024

Based on some offline discussions, I modified the command line option to be more explicit. I would appreciate feedback on the new proposal.

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

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

Using unique long options for this seems like a perfectly good way to handle this. Having to specify multiple options might result in a slightly longer command line than --allow= but that doesn't matter. Plus not having to add custom parsing for this is nice.

--allow-in-use
--allow-ashift-mismatch
--allow-replicaton-mismatch

If you can resolve the recently introduced conflicts this LGTM. Thanks!

@grwilson grwilson force-pushed the ashift_validate branch 3 times, most recently from 8f9e68f to 4a95218 Compare March 27, 2024 15:54
Currently, zpool add allows users to add top-level vdevs that have
different ashifts but doing so prevents users from being able to
perform a top-level vdev removal. Often times consumers may not realize
that they have mismatched ashifts until the top-level removal fails.

This feature adds ashift validation to the zpool add command and will
fail the operation if the sector size of the specified vdev does not
match the existing pool. This behavior can be disabled by using the -f
flag. In addition, new flags have been added to provide fine-grained
control to disable specific checks. These flags
are:

--allow-in-use
--allow-ashift-mismatch
--allow-replicaton-mismatch

The force flag will disable all of these checks.

Signed-off-by: George Wilson <gwilson@delphix.com>
@mmaybee mmaybee merged commit b1e46f8 into openzfs:master Mar 29, 2024
22 of 26 checks passed
tonyhutter pushed a commit that referenced this pull request May 2, 2024
Currently, zpool add allows users to add top-level vdevs that have
different ashifts but doing so prevents users from being able to
perform a top-level vdev removal. Often times consumers may not realize
that they have mismatched ashifts until the top-level removal fails.

This feature adds ashift validation to the zpool add command and will
fail the operation if the sector size of the specified vdev does not
match the existing pool. This behavior can be disabled by using the -f
flag. In addition, new flags have been added to provide fine-grained
control to disable specific checks. These flags
are:

--allow-in-use
--allow-ashift-mismatch
--allow-replicaton-mismatch

The force flag will disable all of these checks.

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Mark Maybee <mmaybee@delphix.com>
Signed-off-by: George Wilson <gwilson@delphix.com>
Closes #15509
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Sep 4, 2024
Currently, zpool add allows users to add top-level vdevs that have
different ashifts but doing so prevents users from being able to
perform a top-level vdev removal. Often times consumers may not realize
that they have mismatched ashifts until the top-level removal fails.

This feature adds ashift validation to the zpool add command and will
fail the operation if the sector size of the specified vdev does not
match the existing pool. This behavior can be disabled by using the -f
flag. In addition, new flags have been added to provide fine-grained
control to disable specific checks. These flags
are:

--allow-in-use
--allow-ashift-mismatch
--allow-replicaton-mismatch

The force flag will disable all of these checks.

Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Mark Maybee <mmaybee@delphix.com>
Signed-off-by: George Wilson <gwilson@delphix.com>
Closes openzfs#15509
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.

4 participants