Skip to content

zdb: ASSERT zrl->zr_refcount == 0 in zrl_destroy() when running zdb -ddddd #17495

Open
@ghtz08

Description

@ghtz08

System information

Type Version/Name
Distribution Name Debian GNU/Linux (running in Proxmox VE)
Distribution Version 12 (bookworm)
Kernel Version 6.8.12-11-pve
Architecture x86_64
OpenZFS Version 2.2.7-pve2

Describe the problem you're observing

When running zdb -ddddd on a specific ZFS dataset, zdb crashes with an assertion failure in zrl_destroy(). The error message is ASSERT at module/zfs/zrlock.c:66:zrl_destroy() zrl->zr_refcount == 0 (0x1 == 0), indicating a range lock was destroyed while its reference count was still 1.
The command is being used to analyze the block distribution of a dataset containing video recording files. The issue occurs on an idle pool and is consistently reproducible. The dataset resides on a pool configured with encryption, a special vdev, and a log vdev.

Describe how to reproduce the problem

The issue can be reliably reproduced on the affected system with the following steps:

  1. Create a ZFS pool with a specific configuration, including a special vdev, log vdev, and encryption. The pool was created with a command similar to this:
    # Note: Device names are sanitized. The key is the pool structure and properties.
    sudo zpool create -o ashift=12 \
                     -O atime=off \
                     -O primarycache=all \
                     -O secondarycache=all \
                     -O checksum=on \
                     -O dedup=off \
                     -O encryption=aes-256-gcm \
                     -O keyformat=raw \
                     -O keylocation=file:///path/to/zfs.key \
                     -O mountpoint=/mnt/hdd hdd \
                     mirror /dev/disk/by-id/ata-disk1 /dev/disk/by-id/ata-disk2 \
                     special mirror /dev/disk/by-id/nvme-ssd1-part3 /dev/disk/by-id/nvme-ssd2-part3 \
                     log mirror /dev/disk/by-id/nvme-ssd1-part2 /dev/disk/by-id/nvme-ssd2-part2
  2. Set additional pool and dataset properties. These non-default properties may be critical to reproducing the bug:
    # Enable autotrim and special_small_blocks on the pool
    sudo zpool set autotrim=on hdd
    sudo zfs set special_small_blocks=16K hdd
    # Create the target dataset
    sudo zfs create hdd/captures
    # Set xattr=sa on the dataset
    sudo zfs set xattr=sa hdd/captures
  3. Populate the dataset with some data. In my case, hdd/captures contains about 119G of video files from OBS recordings.
  4. Run zdb on the dataset. The command will crash and produce the backtrace. Redirecting output to /dev/null or piping it to wc does not change the outcome.
    # This command triggers the assertion failure
    sudo zdb -ddddd hdd/captures > /dev/null

Include any warning/errors/backtraces from the system logs

Here is the full backtrace from the zdb crash:

ASSERT at module/zfs/zrlock.c:66:zrl_destroy()
zrl->zr_refcount == 0 (0x1 == 0)
  PID: 333376    COMM: zdb
  TID: 333448    NAME: zdb
Call trace:
  /lib/x86_64-linux-gnu/libzpool.so.5(libspl_assertf+0x157) [0x771686cfc777]
  /lib/x86_64-linux-gnu/libzpool.so.5(zrl_destroy+0x60) [0x771686c562b0]
  /lib/x86_64-linux-gnu/libzpool.so.5(+0xed19c) [0x771686aed19c]
  /lib/x86_64-linux-gnu/libzpool.so.5(+0x5b470) [0x771686a5b470]
  /lib/x86_64-linux-gnu/libzpool.so.5(+0x58c88) [0x771686a58c88]
  /lib/x86_64-linux-gnu/libc.so.6(+0x891f5) [0x7716862a81f5]
  /lib/x86_64-linux-gnu/libc.so.6(+0x10989c) [0x77168632889c]
zdb(+0x13e03)[0x614fc0fc5e03]
/lib/x86_64-linux-gnu/libc.so.6(+0x3c050)[0x77168625b050]
/lib/x86_64-linux-gnu/libc.so.6(+0x8aeec)[0x7716862a9eec]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x12)[0x77168625afb2]
/lib/x86_64-linux-gnu/libc.so.6(abort+0xd3)[0x771686245472]
/lib/x86_64-linux-gnu/libzpool.so.5(+0x57ad7)[0x771686a57ad7]
/lib/x86_64-linux-gnu/libzpool.so.5(zrl_destroy+0x60)[0x771686c562b0]
/lib/x86_64-linux-gnu/libzpool.so.5(+0xed19c)[0x771686aed19c]
/lib/x86_64-linux-gnu/libzpool.so.5(+0x5b470)[0x771686a5b470]
/lib/x86_64-linux-gnu/libzpool.so.5(+0x58c88)[0x771686a58c88]
/lib/x86_64-linux-gnu/libc.so.6(+0x891f5)[0x7716862a81f5]
/lib/x86_64-linux-gnu/libc.so.6(+0x10989c)[0x77168632889c]
[1]    333374 IOT instruction  sudo zdb -ddddd hdd/captures > /dev/null

Additional Context - Pool Status and Dataset Properties:

zpool status hdd:

pool: hdd
state: ONLINE
config:
NAME                                STATE     READ WRITE CKSUM
hdd                                 ONLINE       0     0     0
mirror-0                          ONLINE       0     0     0
ata-disk1                       ONLINE       0     0     0
ata-disk2                       ONLINE       0     0     0
special
mirror-1                          ONLINE       0     0     0
nvme-ssd1-part3                 ONLINE       0     0     0
nvme-ssd2-part3                 ONLINE       0     0     0
logs
mirror-2                          ONLINE       0     0     0
nvme-ssd1-part2                 ONLINE       0     0     0
nvme-ssd2-part2                 ONLINE       0     0     0

errors: No known data errors

zfs get all hdd/captures (showing key properties):

NAME          PROPERTY              VALUE                     SOURCE
hdd/captures  type                  filesystem                -
hdd/captures  creation              Sat Jun 28 19:10 2025     -
hdd/captures  used                  119G                      -
hdd/captures  available             19.7T                     -
hdd/captures  referenced            119G                      -
hdd/captures  compressratio         1.00x                     -
hdd/captures  mounted               yes                       -
hdd/captures  quota                 none                      default
hdd/captures  reservation           none                      default
hdd/captures  recordsize            128K                      default
hdd/captures  mountpoint            /mnt/hdd/captures         inherited from hdd
hdd/captures  sharenfs              off                       default
hdd/captures  checksum              on                        inherited from hdd
hdd/captures  compression           on                        default
hdd/captures  atime                 off                       inherited from hdd
hdd/captures  devices               on                        default
hdd/captures  exec                  on                        default
hdd/captures  setuid                on                        default
hdd/captures  readonly              off                       default
hdd/captures  zoned                 off                       default
hdd/captures  snapdir               hidden                    default
hdd/captures  aclmode               discard                   default
hdd/captures  aclinherit            restricted                default
hdd/captures  createtxg             315                       -
hdd/captures  canmount              on                        default
hdd/captures  xattr                 sa                        local
hdd/captures  copies                1                         default
hdd/captures  version               5                         -
hdd/captures  utf8only              off                       -
hdd/captures  normalization         none                      -
hdd/captures  casesensitivity       sensitive                 -
hdd/captures  vscan                 off                       default
hdd/captures  nbmand                off                       default
hdd/captures  sharesmb              off                       default
hdd/captures  refquota              none                      default
hdd/captures  refreservation        none                      default
hdd/captures  guid                  6842701555716229603       -
hdd/captures  primarycache          all                       inherited from hdd
hdd/captures  secondarycache        all                       inherited from hdd
hdd/captures  usedbysnapshots       0B                        -
hdd/captures  usedbydataset         119G                      -
hdd/captures  usedbychildren        0B                        -
hdd/captures  usedbyrefreservation  0B                        -
hdd/captures  logbias               latency                   default
hdd/captures  objsetid              80                        -
hdd/captures  dedup                 off                       inherited from hdd
hdd/captures  mlslabel              none                      default
hdd/captures  sync                  standard                  default
hdd/captures  dnodesize             legacy                    default
hdd/captures  refcompressratio      1.00x                     -
hdd/captures  written               0                         -
hdd/captures  logicalused           119G                      -
hdd/captures  logicalreferenced     119G                      -
hdd/captures  volmode               default                   default
hdd/captures  filesystem_limit      none                      default
hdd/captures  snapshot_limit        none                      default
hdd/captures  filesystem_count      none                      default
hdd/captures  snapshot_count        none                      default
hdd/captures  snapdev               hidden                    default
hdd/captures  acltype               off                       default
hdd/captures  context               none                      default
hdd/captures  fscontext             none                      default
hdd/captures  defcontext            none                      default
hdd/captures  rootcontext           none                      default
hdd/captures  relatime              on                        default
hdd/captures  redundant_metadata    all                       default
hdd/captures  overlay               on                        default
hdd/captures  encryption            aes-256-gcm               -
hdd/captures  keylocation           none                      default
hdd/captures  keyformat             raw                       -
hdd/captures  pbkdf2iters           0                         default
hdd/captures  encryptionroot        hdd                       -
hdd/captures  keystatus             available                 -
hdd/captures  special_small_blocks  16K                       inherited from hdd
hdd/captures  snapshots_changed     Mon Jun 30 14:20:06 2025  -
hdd/captures  prefetch              all                       default

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: DefectIncorrect behavior (e.g. crash, hang)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions