Project

General

Profile

Actions

Bug #7982

closed

zfstest -a destroys rpool on IDE disks and should strip partition numbers

Added by Attila Fülöp over 5 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2017-03-19
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

Background:

The OmniOS installer does not detect virtio disks, so my virtual
OmniOS rpool running under SmartOS KVM is on ide0-hd0.

Runing zfstest -a in that OmniOS VM destroys the rpool. (I was lucky
enough to snapshot the zvol before trying zfstest, no damage done)

Analysis:

source

The code which sets $all_disks accepts everything starting with c[0-9]
(zfstest.ksh:40) as disk, but the awk expression which detects disks
used in pools requires disk to start with c[0-9]*t[0-9]*d[0-0]
(zfstest.ksh:42). IDE disks have no target number so they are not
added to $used_disks and end up in the list of disks to use for the
tests.

Fix

Making the target number optional fixes this. While here also strip
partition numbers (p[0-9]+) as already done for slice
numbers. Partition numbers may exist in the wild.

Testing

Successfully ran zftest with the patch applied, rpool survived ;-),
three unused virtio disks where all detected and used.

Tested awk regexp with /usr/bin/awk, /usr/gnu/bin/awk and
/usr/xpg4/bin/awk, same for sed.

I'll open an openzfs PR on github and prepare a webrev.

Actions

Also available in: Atom PDF