Project

General

Profile

Actions

Feature #13013

closed

Port OpenZFS zpool label clear improvements

Added by Jason King 10 months ago. Updated 9 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
zfs - Zettabyte File System
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

As a prerequisite for persistent L2ARC, it will help to have this OpenZFS change ported as a prerequisite:

From 066da71e7fe32f569736b53454b034937d0d3813 Mon Sep 17 00:00:00 2001
From: Brian Behlendorf <behlendorf1@llnl.gov>
Date: Thu, 21 Mar 2019 10:13:01 -0700
Subject: [PATCH] Improve `zpool labelclear`

1) As implemented the `zpool labelclear` command overwrites
the calculated offsets of all four vdev labels even when only a
single valid label is found.  If the device as been re-purposed
but still contains a valid label this can result in space no
longer owned by ZFS being zeroed.  Prevent this by verifying
every label removed is intact before it's overwritten.

2) Address a small bug in zpool_do_labelclear() which prevented
labelclear from working on file vdevs.  Only block devices support
BLKFLSBUF, try the ioctl() but when it's reported as unsupported
this should not be fatal.

3) Fix `zpool labelclear` so it can be run on vdevs which were
removed from the pool with `zpool remove`.  Additionally, allow
intact but partial labels to be cleared as in the case of a failed
`zpool attach` or `zpool replace`.

4) Remove LABELCLEAR and LABELREAD variables for test cases.

Reviewed-by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Tim Chase <tim@chase2k.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #8500
Closes #8373
Closes #6261

This also needs the fixes in #13012 for the added zfs tests to pass.


Related issues

Related to illumos gate - Bug #13012: zpool_read_label semantics should match OpenZFSClosedJason King

Actions
Related to illumos gate - Feature #3525: Persistent L2ARCClosedJason King2013-02-04

Actions
Actions #1

Updated by Jason King 10 months ago

  • Related to Bug #13012: zpool_read_label semantics should match OpenZFS added
Actions #2

Updated by Jason King 10 months ago

Actions #3

Updated by Electric Monk 9 months ago

  • Gerrit CR set to 834
Actions #4

Updated by Jason King 9 months ago

To test, I ran the zfs test suite. All the expected tests pass (including the new tests introduced with this change).

Additionally, I create a test zpool with a regular device, an slog, and an l2arc device. I ran fstyp against all three devices, which properly identified them as zfs devices. After destroying the test pool, the regular and slog devices now show unknown_fstyp while the cache device still shows zfs. However, this appears to be an existing bug as I was able to reproduce the behavior on an unmodified BE (running 'zpool labelclear' on the device clears out the label on the cache device though, so there is a workaround).

Actions #5

Updated by Electric Monk 9 months ago

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

git commit 0ac8993002ee179cc3289243a0fc956ee0db04da

commit  0ac8993002ee179cc3289243a0fc956ee0db04da
Author: Brian Behlendorf <behlendorf1@llnl.gov>
Date:   2020-08-12T02:23:17.000Z

    13013 Port OpenZFS zpool label clear improvements
    13012 zpool_read_label semantics should match OpenZFS
    Portions contributed by: Jason King <jason.king@joyent.com>
    Reviewed by: Matt Ahrens <mahrens@delphix.com>
    Reviewed by: Tim Chase <tim@chase2k.com>
    Reviewed by: Tony Hutter <hutter2@llnl.gov>
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF