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

zfs create -V manpage and code discrepancy #8541

Closed
puffi opened this issue Mar 28, 2019 · 3 comments · Fixed by #10196
Closed

zfs create -V manpage and code discrepancy #8541

puffi opened this issue Mar 28, 2019 · 3 comments · Fixed by #10196
Labels
good first issue Indicates a good issue for first-time contributors Type: Documentation Indicates a requested change to the documentation

Comments

@puffi
Copy link

puffi commented Mar 28, 2019

System information

Type Version/Name
Distribution Name Proxmox VE
Distribution Version 5.3-1
Linux Kernel 4.15.18-12-pve
Architecture amd64
ZFS Version 0.7.13-pve1~bpo2
SPL Version 0.7.13-pve1~bpo2

Describe the problem you're observing

man zfs states under zfs create -V: size is automatically rounded up to the nearest 128 Kbytes to ensure that the volume has an integral number of blocks regardless of blocksize.
But the following command (with a volblocksize of 8K) zfs create -V 35K nvme/foo fails with the following error message: cannot create 'nvme/foo': volume size must be a multiple of volume block size

Describe how to reproduce the problem

Create a zvol with a size that's not aligned to the volblocksize (see command above).

@behlendorf behlendorf added Type: Documentation Indicates a requested change to the documentation good first issue Indicates a good issue for first-time contributors labels Mar 28, 2019
@behlendorf
Copy link
Contributor

Nice find. I suggest we update the code to round up as described in the documentation. We'll want to update the man page as well since the maximum blocksize can now exceed 128k.

@tapaswenipathak
Copy link

Hi @behlendorf -

I am getting confused while seeing the dir structure. I read few tickets. I know this ticket has a straight forward fix. Can you tell me how the directories are structured? or point me docs?

Few things I did -

@behlendorf
Copy link
Contributor

@tapaswenipathak sure thing. The bulk of the ZFS implementation is located in module/zfs/ directory, these source files are compiled in to the zfs.ko kernel module. The main entry point on the kernel side for administrative commands, like zpool create, can be found in zfs_ioctl.c file. These operations are handled as ZFS specific ioctls issued by the user space utilities, zfs, zpool.

Specifically, the logic which check this can be found here in the zfs_ioc_create() function where zvol_check_volsize() is called. It looks like volume creation fails when it's not a multiple of the block size, which is right since we want the kernel to be strict when handling this.

You're going to want to address this by updating the zfs command line utility so it passes the volume size rounded up to the block size to the kernel. For that, you'll want to start with the zfs_do_create() function in cmd/zfs/zfs_main.c. That should get you started, thanks for looking in to this.

@behlendorf behlendorf mentioned this issue Jul 1, 2019
12 tasks
behlendorf pushed a commit that referenced this issue Apr 25, 2020
Round up the volume size requested in `zfs create -V size` to the next
higher multiple of the volblocksize. Updates the man page and adds a
test to verify the new behavior.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reported-by: puffi <puffi@users.noreply.github.com>
Signed-off-by: Alex John <alex@stty.io>
Closes #8541 
Closes #10196
as-com pushed a commit to as-com/zfs that referenced this issue Jun 20, 2020
Round up the volume size requested in `zfs create -V size` to the next
higher multiple of the volblocksize. Updates the man page and adds a
test to verify the new behavior.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reported-by: puffi <puffi@users.noreply.github.com>
Signed-off-by: Alex John <alex@stty.io>
Closes openzfs#8541 
Closes openzfs#10196 
(cherry picked from commit 47c9299)
jsai20 pushed a commit to jsai20/zfs that referenced this issue Mar 30, 2021
Round up the volume size requested in `zfs create -V size` to the next
higher multiple of the volblocksize. Updates the man page and adds a
test to verify the new behavior.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reported-by: puffi <puffi@users.noreply.github.com>
Signed-off-by: Alex John <alex@stty.io>
Closes openzfs#8541 
Closes openzfs#10196
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Indicates a good issue for first-time contributors Type: Documentation Indicates a requested change to the documentation
Projects
None yet
3 participants