Unverified Commit 3ee4e6d8 authored by Tony Hutter's avatar Tony Hutter Committed by GitHub
Browse files

vdev_id: Fix partition regular expression


Given a DM device name, the old vdev_id script would extract any text
after a 'p' as the partition number.  It then appends "-part" + the
partition number to the name, giving a by-vdev name like "L0-part5".

This works fine if the DM name is like 'dm-2p5', but doesn't work if
the DM name is a multipath name like "mpatha".  In those cases it
incorrectly matches the 'p' in "mpatha", giving by-vdev names like
"L0-partatha".

This patch fixes the issue by making the partition regex match stricter.
Reviewed-by: default avatarBrian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: default avatarTony Hutter <hutter2@llnl.gov>
Closes #11637 
parent 1dfc82a1
base NAS-113163 NAS-116738 NAS-116738-prev NAS-117105 NAS-117807 NAS-117807-1 NAS-117845-dbg NAS-117845-dbg2-ozfs-mater NAS-117880 NAS-119759-1 NAS-121790 NAS-122915 NAS-122949 NAS-123279-2 NAS-124189-cobia NAS-124564 NAS-124699 NAS-124699-2 NAS-124699-3 NAS-124699-3-test NAS-125150 NAS-125882 NAS-125882-2 NAS-125916 NAS-125916-1 NAS-127352 NAS-127352-tn NAS-127702 NAS-127702-1 NAS-127702-df NAS-127822 NAS-127822-debug NAS-127888 NAS-127888-truenas TS-23.10 add-check-for-cached-acl-in-zpl_permission add-ctldir-snapcount add-fd-to-zhandle add-json-output-to-zfs add-xattr-related-flag allow-path-to-zhandle-in-ctldir backport-large_block dragonfish/zfs-2.2.4-staging experiment-with-createtxg fix-abi fix-archive-behavior fix-dosmode-behavior-linux fix-mode-007 freebsd-simplify-trivial-acl-check integrate master nfsacl nfsacl-1 nfsacl-a nfsacl-review nfsv4acl nfsv4acls ozfs_master_test pkg-test raidz-expansion-rebase rel-v0.0.1 release-test/22.02.3 release/21.06-BETA.1 release/21.08-BETA.1 release/21.08-BETA.2 release/22.02 release/22.02-RC.1 release/22.02-RC.2 release/22.02-test release/22.02.1 release/22.02.2 release/22.02.3 release/22.02.4 release/22.12 release/22.12-BETA.1 release/22.12-BETA.2 release/22.12-RC.1 release/22.12.1 release/22.12.2 release/22.12.3 release/22.12.3.3 release/22.12.4 release/22.2-RC.1 release/23.10-BETA.1 release/23.10-RC.1 release/23.10.0 release/23.10.1 release/23.10.1.2 release/23.10.1.3 release/23.10.2 release/24.04-BETA.1 release/24.04-RC.1 release/24.04.0 set-sast-config-1 stable/angelfish stable/bluefin stable/cobia stable/dragonfish streaminfo_xattr test test-ci test-inode-owner-change test-linux-stat-zfscltdir test_pkg testing-refine-branchout-process testing-refine-branchout-process2 testing/fix-sendrecv tmprelease/test-21.08 tmprelease/test-21.09 tmprelease/test2-21.09 tmprelease/test3-21.09 tmprelease/test4-21.09 tn_master truenas/13.0-u5.3-stable truenas/NAS-127822-debug truenas/dragonfish-2.2.2-test truenas/zfs-2.1-release truenas/zfs-2.1.13-upstream truenas/zfs-2.2-release truenas/zfs-2.2.1-hutter truenas/zfs-2.2.1-hutter2 truenas/zfs-2.2.1-release truenas/zfs-2.2.1-release-dragonfish truenas/zfs-2.2.3-staging-dragonfish truenas/zfs-2.2.3-testing truenas/zfs-2.2.4-staging truenas/zfs-2.3-release truenas/zfs-2.3-testing truenas/zfs-cobia-rc1-test truenas/zvol-multi-taskq truenas/zvol-multiq truenas/zvol-multiq-clean truenas/zvol-thread-property zfetch_reorder zfetch_reorder10 zfs-2.1-release zfs-issue-13217 zfs-json zfs-ozfs-master zvol-cleanup zvol-improvements-2.2.1 zvol-ro-property zvol-thread-property zvol_multi_taskq zvol_multiq zfs-2.1.99 zfs-2.1.2 zfs-2.1.1 zfs-2.1.0 zfs-2.1.0-rc8 zfs-2.1.0-rc7 zfs-2.1.0-rc6 zfs-2.1.0-rc5 zfs-2.1.0-rc4 zfs-2.1.0-rc3 zfs-2.1.0-rc2 zfs-2.1.0-rc1 TS-24.04-RC.1 TS-24.04-BETA.1 TS-23.10.2 TS-23.10.1.3 TS-23.10.1.2 TS-23.10.1.1 TS-23.10.1 TS-23.10.0.1 TS-23.10.0 TS-23.10-RC.1 TS-23.10-BETA.1 TS-22.12.4.2 TS-22.12.4.1 TS-22.12.4 TS-22.12.3.3 TS-22.12.3.2 TS-22.12.3.1 TS-22.12.3 TS-22.12.2 TS-22.12.1 TS-22.12.0 TS-22.12-RC.1 TS-22.12-BETA.2 TS-22.12-BETA.1 TS-22.12-ALPHA.1 TS-22.02.4 TS-22.02.3 TS-22.02.2.1 TS-22.02.2 TS-22.02.1 TS-22.2.1 TS-22.02.0.1 TS-22.02.0 TS-22.2.0 TS-22.02.RELEASE.1 TS-22.02-RC.2 TS-22.02-RC.1 TS-22.02-RC.1-2 TS-22.02-RC.1-1 TS-21.08-BETA.2 TS-21.08-BETA.1 TS-21.06-BETA.1 TS-12.12.3 DN110M-CS-v2.0
No related merge requests found
Showing with 9 additions and 3 deletions
+9 -3
......@@ -285,7 +285,9 @@ sas_handler() {
# we have to append the -part suffix directly in the
# helper.
if [ "$DEVTYPE" != "partition" ] ; then
PART=$(echo "$DM_NAME" | awk -Fp '/p/{print "-part"$2}')
# Match p[number], remove the 'p' and prepend "-part"
PART=$(echo "$DM_NAME" |
awk 'match($0,/p[0-9]+$/) {print "-part"substr($0,RSTART+1,RLENGTH-1)}')
fi
# Strip off partition information.
......@@ -499,7 +501,9 @@ scsi_handler() {
# we have to append the -part suffix directly in the
# helper.
if [ "$DEVTYPE" != "partition" ] ; then
PART=$(echo "$DM_NAME" | awk -Fp '/p/{print "-part"$2}')
# Match p[number], remove the 'p' and prepend "-part"
PART=$(echo "$DM_NAME" |
awk 'match($0,/p[0-9]+$/) {print "-part"substr($0,RSTART+1,RLENGTH-1)}')
fi
# Strip off partition information.
......@@ -648,7 +652,9 @@ alias_handler () {
DM_PART=
if echo "$DM_NAME" | grep -q -E 'p[0-9][0-9]*$' ; then
if [ "$DEVTYPE" != "partition" ] ; then
DM_PART=$(echo "$DM_NAME" | awk -Fp '/p/{print "-part"$2}')
# Match p[number], remove the 'p' and prepend "-part"
DM_PART=$(echo "$DM_NAME" |
awk 'match($0,/p[0-9]+$/) {print "-part"substr($0,RSTART+1,RLENGTH-1)}')
fi
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment