Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic when reading properties of volume snapshots #260

Open
ociaw opened this issue Mar 4, 2024 · 2 comments
Open

Panic when reading properties of volume snapshots #260

ociaw opened this issue Mar 4, 2024 · 2 comments

Comments

@ociaw
Copy link
Contributor

ociaw commented Mar 4, 2024

Describe the bug

libzetta panics when reading the properties of snapshots of volumes:

thread 'main' panicked at /home/username/.cargo/git/checkouts/libzetta-rs-2c006bbd2fc21a39/7191a10/src/zfs/open3.rs:493:45:
Failed to build properties: UninitializedField("devices")

libzetta expects the properties devices, exec, setuid, xattr, version, and casesensitivity to exist on every snapshot. However, these properties do not appear on volume snapshots, causing a panic.

To Reproduce

Attempt to get the properties of a snapshot without a devices property. For example, only the following properties are present on a snapshot of a volume on my pool:

> zfs get -Hp all bulk/encrypted/images/testing-popos
bulk/encrypted/images/testing-popos     type    volume  -
bulk/encrypted/images/testing-popos     creation        1639013065      -
bulk/encrypted/images/testing-popos     used    340523659264    -
bulk/encrypted/images/testing-popos     available       1575171211264   -
bulk/encrypted/images/testing-popos     referenced      340523659264    -
bulk/encrypted/images/testing-popos     compressratio   1.61    -
bulk/encrypted/images/testing-popos     reservation     0       default
bulk/encrypted/images/testing-popos     volsize 549755813888    local
bulk/encrypted/images/testing-popos     volblocksize    16384   default
bulk/encrypted/images/testing-popos     checksum        on      default
bulk/encrypted/images/testing-popos     compression     zstd    inherited from bulk
bulk/encrypted/images/testing-popos     readonly        off     default
bulk/encrypted/images/testing-popos     createtxg       165358  -
bulk/encrypted/images/testing-popos     copies  1       default
bulk/encrypted/images/testing-popos     refreservation  0       default
bulk/encrypted/images/testing-popos     guid    13843560448143234298    -
bulk/encrypted/images/testing-popos     primarycache    all     default
bulk/encrypted/images/testing-popos     secondarycache  all     default
bulk/encrypted/images/testing-popos     usedbysnapshots 0       -
bulk/encrypted/images/testing-popos     usedbydataset   340523659264    -
bulk/encrypted/images/testing-popos     usedbychildren  0       -
bulk/encrypted/images/testing-popos     usedbyrefreservation    0       -
bulk/encrypted/images/testing-popos     logbias latency default
bulk/encrypted/images/testing-popos     objsetid        1415    -
bulk/encrypted/images/testing-popos     dedup   off     default
bulk/encrypted/images/testing-popos     mlslabel        none    default
bulk/encrypted/images/testing-popos     sync    standard        default
bulk/encrypted/images/testing-popos     refcompressratio        1.61    -
bulk/encrypted/images/testing-popos     written 0       -
bulk/encrypted/images/testing-popos     logicalused     545906790912    -
bulk/encrypted/images/testing-popos     logicalreferenced       545906790912    -
bulk/encrypted/images/testing-popos     volmode default default
bulk/encrypted/images/testing-popos     snapshot_limit  none    default
bulk/encrypted/images/testing-popos     snapshot_count  none    default
bulk/encrypted/images/testing-popos     snapdev hidden  default
bulk/encrypted/images/testing-popos     context none    default
bulk/encrypted/images/testing-popos     fscontext       none    default
bulk/encrypted/images/testing-popos     defcontext      none    default
bulk/encrypted/images/testing-popos     rootcontext     none    default
bulk/encrypted/images/testing-popos     redundant_metadata      all     default
bulk/encrypted/images/testing-popos     encryption      aes-256-gcm     -
bulk/encrypted/images/testing-popos     keylocation     none    default
bulk/encrypted/images/testing-popos     keyformat       passphrase      -
bulk/encrypted/images/testing-popos     pbkdf2iters     350000  -
bulk/encrypted/images/testing-popos     encryptionroot  bulk/encrypted  -
bulk/encrypted/images/testing-popos     keystatus       available       -

Expected behavior

No panic occurs. Unsure if the final solution should simply ignore the missing properties or if a new type (such as VolumeSnapshotProperties) should be created, as there are a number of volume-specific properties such as volblocksize that are not represented in SnapshotProperties.

Please complete the following information:

  • OS: Fedora 39
  • ZFS version: 2.2.3
  • libZetta version: v0.5.0
@ociaw ociaw added the Type: Bug label Mar 4, 2024
@ociaw ociaw changed the title Panic on when reading properties of volume snapshots Panic when reading properties of volume snapshots Mar 4, 2024
@andoriyu
Copy link
Member

andoriyu commented Mar 5, 2024

I will take a look later this week and cut a new release after fixing it.

@andoriyu
Copy link
Member

andoriyu commented Mar 5, 2024

I guess it's either make them optional or make a separate Properties type. Both are breaking change. if there is no objections, then I will go with making them optional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants