Project

General

Profile

Actions

Bug #13012

closed

zpool_read_label semantics should match OpenZFS

Added by Jason King about 1 year ago. Updated about 1 year 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

With #12235, the zpool_read_label() function was moved to libzutil (to match what OpenZFS had done). However, the OpenZFS change also changed the semantics of zpool_read_label() slightly -- prior to that change, zpool_read_label() returned on the first label found, and returned -1 if no labels were found, if no memory was available, or if it couldn't stat the device given. The OpenZFS version allows one to optionally pass a pointer that is used to return the number of labels found. More importantly, 0 labels found is not considered an error.

To facilitate porting of OpenZFS, it will be easier to update zpool_read_label to match the OpenZFS semantics. There's only a few consumers in illumos-gate (and this is a private interface), and /illumos-joyent/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c is the only caller that needs updating.


Related issues

Related to illumos gate - Feature #13013: Port OpenZFS zpool label clear improvementsClosedJason King

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

Actions
Actions #1

Updated by Jason King about 1 year ago

  • Related to Feature #13013: Port OpenZFS zpool label clear improvements added
Actions #2

Updated by Jason King about 1 year ago

Actions #3

Updated by Electric Monk about 1 year ago

  • Gerrit CR set to 834
Actions #4

Updated by Jason King about 1 year 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 about 1 year 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