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

Can't change an open zvol's volsize after a rename #16127

Closed
asomers opened this issue Apr 24, 2024 · 0 comments · Fixed by #16128
Closed

Can't change an open zvol's volsize after a rename #16127

asomers opened this issue Apr 24, 2024 · 0 comments · Fixed by #16128
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@asomers
Copy link
Contributor

asomers commented Apr 24, 2024

System information

Type Version/Name
Distribution Name FreeBSD
Distribution Version FreeBSD
Kernel Version 13.2-RELEASE, 14.0-RELEASE, 15.0-CURRENT
Architecture amd64
OpenZFS Version zfs-kmod-2.1.9-FreeBSD_g92e0d9d18, zfs-kmod-2.2.0-FreeBSD_g95785196f, zfs-kmod-2.2.99-440-FreeBSD_g90ba19eb7

Describe the problem you're observing

It should be possible to successfully do zfs set volsize on a zvol even if that zvol is currently open. Indeed it works. However, if the zvol was renamed prior to being opened, then this command will fail with EBUSY.

Describe how to reproduce the problem

sudo zfs create -V 1m -o volmode=dev zroot/test/testvol
sudo zfs rename zroot/test/testvol zroot/test/testvol2
#  In a separate terminal, open the device and hold it open, for example using this Python one-liner:
#  fd = open("/dev/zvol/zroot/test/testvol2")
sudo zfs set volsize=8g zroot/test/testvol2
cannot set property for 'zroot/test/testvol2': dataset is busy

Include any warning/errors/backtraces from the system logs

None

Investigation so far

Using dtrace, I've determined that zvol_find_by_name_hash, as called by zvol_set_volsize, works when the zvol has not been renamed. But if the zvol has been renamed, then this function fails. Therefore, I suspect a bug in zvol_os_rename_minor. I intend to keep working on the problem.

@asomers asomers added the Type: Defect Incorrect behavior (e.g. crash, hang) label Apr 24, 2024
asomers added a commit to asomers/zfs that referenced this issue Apr 24, 2024
When renaming a zvol, insert it into zvol_htable using the new name, not
the old name.  Otherwise some operations won't work.  For example,
"zfs set volsize" while the zvol is open.

Sponsored by:	Axcient
Signed-off-by:	Alan Somers <asomers@FreeBSD.org>
Closes openzfs#16127
behlendorf pushed a commit that referenced this issue Apr 25, 2024
When renaming a zvol, insert it into zvol_htable using the new name, not
the old name.  Otherwise some operations won't work.  For example,
"zfs set volsize" while the zvol is open.

Sponsored by:	Axcient
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alek Pinchuk <apinchuk@axcient.com>
Signed-off-by:	Alan Somers <asomers@FreeBSD.org>
Closes #16127
Closes #16128
tonyhutter pushed a commit that referenced this issue May 2, 2024
When renaming a zvol, insert it into zvol_htable using the new name, not
the old name.  Otherwise some operations won't work.  For example,
"zfs set volsize" while the zvol is open.

Sponsored by:	Axcient
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alek Pinchuk <apinchuk@axcient.com>
Signed-off-by:	Alan Somers <asomers@FreeBSD.org>
Closes #16127
Closes #16128
lundman pushed a commit to openzfsonwindows/openzfs that referenced this issue Sep 4, 2024
When renaming a zvol, insert it into zvol_htable using the new name, not
the old name.  Otherwise some operations won't work.  For example,
"zfs set volsize" while the zvol is open.

Sponsored by:	Axcient
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alek Pinchuk <apinchuk@axcient.com>
Signed-off-by:	Alan Somers <asomers@FreeBSD.org>
Closes openzfs#16127
Closes openzfs#16128
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.

1 participant