zfs icon indicating copy to clipboard operation
zfs copied to clipboard

zvol snapshot rename doesn't rename -partN devices

Open JKDingwall opened this issue 6 months ago • 2 comments

System information

Type Version/Name
Distribution Name Ubuntu
Distribution Version 24.04
Kernel Version 6.8.0-60-generic
Architecture amd64
OpenZFS Version 2.2.7

Describe the problem you're observing

This is related to issue #14223 / #16600. Although the top level snapshot is correctly renamed any -partN devices related to it remain in /dev/zvol/.../.../ referencing the old name.

Describe how to reproduce the problem

  1. create a zvol with a partition table, there should be /dev/zvol/ztank/name, /dev/zvol/ztank/name-part1 devices
  2. create a snapshot , e.g. zfs snapshot ztank/name@snap1 of that volume (snapdev=visible), there should be /dev/zvol/ztank/name@snap1, /dev/zvol/ztank/name@snap1-part1
  3. rename the snapshot, e.g. zfs rename ztank/name@snap1 ztank/name@snap2, /dev/zvol/tank/name@snap2 exists but /dev/zvol/ztank/name@snap1-part1 is not renamed to /dev/zvol/ztank/name@snap2-part1

Running with udevadm monitor -k -u we see no change event for the p1 device:

# zfs create ztank/name@snap1
KERNEL[82773.152904] add      /devices/virtual/bdi/230:3888 (bdi)
KERNEL[82773.154845] add      /devices/virtual/block/zd3888 (block)
KERNEL[82773.154991] add      /devices/virtual/block/zd3888/zd3888p1 (block)
UDEV  [82773.170977] add      /devices/virtual/bdi/230:3888 (bdi)
UDEV  [82773.280616] add      /devices/virtual/block/zd3888 (block)
UDEV  [82773.390334] add      /devices/virtual/block/zd3888/zd3888p1 (block)

# zfs rename ztank/name@snap1 ztank/name@snap2
KERNEL[82973.460582] change   /devices/virtual/block/zd3888 (block)
KERNEL[82973.460954] change   /devices/virtual/block/zd3888 (block)
UDEV  [82973.573731] change   /devices/virtual/block/zd3888 (block)
UDEV  [82973.671342] change   /devices/virtual/block/zd3888 (block)

Include any warning/errors/backtraces from the system logs

JKDingwall avatar Jun 05 '25 11:06 JKDingwall

On further investigation that it is a snapshot is irrelevant, the same behaviour is observed for the volume. I have a working solution which is based on the Linux kernel disk_uevent() function but that requires the use of GPL symbols. What is the usual way to approach the licence incompatibility? I've done a bit of a search but can't find any guidelines.

JKDingwall avatar Jun 05 '25 15:06 JKDingwall

I have a wip branch for this: https://github.com/JKDingwall/zfs/tree/JKDingwall/17428-zvol-rename-partition-uevents

JKDingwall avatar Jun 09 '25 07:06 JKDingwall