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

Renaming a zvol does not update the kstat's dataset_name #15482

Closed
asomers opened this issue Nov 2, 2023 · 3 comments · Fixed by #15486
Closed

Renaming a zvol does not update the kstat's dataset_name #15482

asomers opened this issue Nov 2, 2023 · 3 comments · Fixed by #15486
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@asomers
Copy link
Contributor

asomers commented Nov 2, 2023

System information

Type Version/Name
Operating System Name FreeBSD
Distribution Version 15.0-CURRENT
Kernel Version git main, as of 6-Oct 2023. 13.1-RELEASE and 13.2-RELEASE are also affected
Architecture amd64
OpenZFS Version zfs-2.2.99-FreeBSD_g0ee9b0239 zfs-kmod-2.2.99-FreeBSD_gf795e90a1
Type Version/Name
Operating System Name Debian GNU/Linux
Distribution Version 11.6
Kernel Version 5.10.0-21-amd64
Architecture amd64
OpenZFS Version zfs-2.0.3-9 zfs-kmod-2.0.3-9

Describe the problem you're observing

The kstat.zfs.<POOLNAME>.dataset.objset-0x<OBJID> sysctl nodes publish statistics about ZFS datasets, such as throughput. The "dataset_name" node contains the name of the ZFS dataset. For file system datasets, renaming the dataset also updates the value of dataset_name. But for zvols, it does not. After the rename, dataset_name still contains the dataset's prior name.

Describe how to reproduce the problem

These instructions work on FreeBSD. For Linux, do cat /proc/spl/kstat/zfs/testpool/objset-XXX instead of using sysctl.

$ zpool create testpool vtbd1
$ zfs create -V1m testpool/testvol
$ sysctl -n kstat.zfs.testpool.dataset.objset-$(printf 0x%x $(zfs get -Hpo value objsetid testpool/testvol)).dataset_name
testpool/testvol
$ sudo zfs rename testpool/testvol testpool/yyy
$ sysctl -n kstat.zfs.testpool.dataset.objset-$(printf 0x%x $(zfs get -Hpo value objsetid testpool/yyy)).dataset_name
testpool/testvol
@asomers asomers added the Type: Defect Incorrect behavior (e.g. crash, hang) label Nov 2, 2023
asomers added a commit to asomers/zfs that referenced this issue Nov 2, 2023
Closes		openzfs#15482 (for FreeBSD only)
Sponsored-by:	Axcient
Signed-off-by:	Alan Somers <asomers@gmail.com>
@lundman
Copy link
Contributor

lundman commented Nov 2, 2023

Ah that is true and probably also the case in Solaris/illumos, certainly the case in Windows/macOS.

@asomers
Copy link
Contributor Author

asomers commented Nov 2, 2023

I'm testing a fix for FreeBSD now.

asomers added a commit to asomers/zfs that referenced this issue Nov 2, 2023
Closes		openzfs#15482 (for FreeBSD only)
Sponsored-by:	Axcient
Signed-off-by:	Alan Somers <asomers@gmail.com>
@lundman
Copy link
Contributor

lundman commented Nov 2, 2023

I see no immediate reason that wouldn't work for Windows/macOS..?

asomers added a commit to asomers/zfs that referenced this issue Nov 2, 2023
Closes		openzfs#15482 (for FreeBSD only)
Sponsored-by:	Axcient
Signed-off-by:	Alan Somers <asomers@gmail.com>
asomers added a commit to asomers/zfs that referenced this issue Nov 3, 2023
Closes          openzfs#15482 (for Linux only)
Sponsored-by:   Axcient
Signed-off-by:  Alan Somers <asomers@gmail.com>
behlendorf pushed a commit that referenced this issue Nov 7, 2023
Add a dataset_kstats_rename function, and call it when renaming
a zvol on FreeBSD and Linux.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alan Somers <asomers@gmail.com>
Sponsored-by: Axcient
Closes #15482
Closes #15486
lundman pushed a commit to openzfsonwindows/openzfs that referenced this issue Dec 12, 2023
Add a dataset_kstats_rename function, and call it when renaming
a zvol on FreeBSD and Linux.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alan Somers <asomers@gmail.com>
Sponsored-by: Axcient
Closes openzfs#15482
Closes openzfs#15486
mmatuska pushed a commit to mmatuska/zfs that referenced this issue Dec 27, 2023
Add a dataset_kstats_rename function, and call it when renaming
a zvol on FreeBSD and Linux.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alan Somers <asomers@gmail.com>
Sponsored-by: Axcient
Closes openzfs#15482
Closes openzfs#15486
behlendorf pushed a commit that referenced this issue Jan 9, 2024
Add a dataset_kstats_rename function, and call it when renaming
a zvol on FreeBSD and Linux.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alan Somers <asomers@gmail.com>
Sponsored-by: Axcient
Closes #15482
Closes #15486
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants