Project

General

Profile

Bug #7982

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

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

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

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

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.

History

#1

Updated by Electric Monk over 2 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

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>

Also available in: Atom PDF