Bug #7982
closedzfstest -a destroys rpool on IDE disks and should strip partition numbers
100%
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:¶
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.
Updated by Electric Monk over 5 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
git commit ce326879a41b052db3abafb44e551f9d9c40cdba
commit ce326879a41b052db3abafb44e551f9d9c40cdba Author: Attila Fülöp <attila@fueloep.org> Date: 2017-03-28T22:28:10.000Z 7982 zfstest -a destroys rpool on IDE disks and should strip partition numbers Reviewed by: John Wren Kennedy <john.kennedy@delphix.com> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Matthew Ahrens <mahrens@delphix.com>