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

Restore support for in-kernel ZFS ioctls. #10417

Merged
merged 1 commit into from
Jun 8, 2020
Merged

Conversation

pjd
Copy link
Contributor

@pjd pjd commented Jun 7, 2020

Motivation and Context

During code reading of ZFS ioctl handling I found some dead code: the zc_iflags field in the zfs_cmd structure is always 0 due to:

int flag = 0;
[...]
zc->zc_iflags = flag & FKIOCTL;

In Illumos it is possible to call ioctl functions from within the kernel by passing the FKIOCTL flag. Neither FreeBSD nor Linux support that, but it doesn't hurt to keep it around, as all the code is there.

Description

Restore this functionality by allowing to pass a flag to the zfsdev_ioctl_common() function.

If we decide to entirely drop support for Illumos, we could remove the flag argument from zfsdev_ioctl_common(), remove zc_iflags field from the zfs_cmd structure, remove the iflag argument from the get_nvlist() function and remove the flags argument from the ddi_copyout() function.

How Has This Been Tested?

The code was compiled on FreeBSD, module was loaded and few operations were performed to test that ioctls to /dev/zfs still work.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the contributing document.
  • I have added tests to cover my changes.
  • I have run the ZFS Test Suite with this change applied.
  • All commit messages are properly formatted and contain Signed-off-by.

In Illumos it is possible to call ioctl functions from within the
kernel by passing the FKIOCTL flag. Neither FreeBSD nor Linux support
that, but it doesn't hurt to keep it around, as all the code is there.

Before this commit it was a dead code and zc_iflags was always zero.
Restore this functionality by allowing to pass a flag to the
zfsdev_ioctl_common() function.

Signed-off-by:	Pawel Jakub Dawidek <pawel@dawidek.net>
@codecov
Copy link

codecov bot commented Jun 8, 2020

Codecov Report

Merging #10417 into master will decrease coverage by 0.06%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10417      +/-   ##
==========================================
- Coverage   79.61%   79.54%   -0.07%     
==========================================
  Files         391      391              
  Lines      123603   123603              
==========================================
- Hits        98402    98318      -84     
- Misses      25201    25285      +84     
Flag Coverage Δ
#kernel 79.97% <100.00%> (+<0.01%) ⬆️
#user 66.04% <ø> (-0.10%) ⬇️
Impacted Files Coverage Δ
module/os/linux/zfs/zfs_ioctl_os.c 85.18% <100.00%> (ø)
module/zfs/zfs_ioctl.c 86.40% <100.00%> (ø)
cmd/zdb/zdb_il.c 30.86% <0.00%> (-24.08%) ⬇️
module/zcommon/zfs_fletcher.c 68.09% <0.00%> (-10.20%) ⬇️
module/lua/lmem.c 83.33% <0.00%> (-4.17%) ⬇️
module/zcommon/zfs_fletcher_superscalar.c 97.05% <0.00%> (-2.95%) ⬇️
module/zcommon/zfs_uio.c 86.73% <0.00%> (-2.05%) ⬇️
cmd/ztest/ztest.c 79.43% <0.00%> (-1.86%) ⬇️
module/zcommon/zfs_fletcher_superscalar4.c 98.43% <0.00%> (-1.57%) ⬇️
module/zcommon/zfs_fletcher_sse.c 98.66% <0.00%> (-1.34%) ⬇️
... and 59 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3bf3b16...5eae8b8. Read the comment docs.

@ghost ghost added the Status: Code Review Needed Ready for review and testing label Jun 8, 2020
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Jun 8, 2020
@behlendorf behlendorf merged commit 529246d into openzfs:master Jun 8, 2020
BrainSlayer pushed a commit to BrainSlayer/zfs that referenced this pull request Jun 10, 2020
In Illumos it is possible to call ioctl functions from within the
kernel by passing the FKIOCTL flag. Neither FreeBSD nor Linux support
that, but it doesn't hurt to keep it around, as all the code is there.

Before this commit it was a dead code and zc_iflags was always zero.
Restore this functionality by allowing to pass a flag to the
zfsdev_ioctl_common() function.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Pawel Jakub Dawidek <pawel@dawidek.net>
Closes openzfs#10417
lundman referenced this pull request in openzfsonosx/openzfs Jun 12, 2020
In Illumos it is possible to call ioctl functions from within the
kernel by passing the FKIOCTL flag. Neither FreeBSD nor Linux support
that, but it doesn't hurt to keep it around, as all the code is there.

Before this commit it was a dead code and zc_iflags was always zero.
Restore this functionality by allowing to pass a flag to the
zfsdev_ioctl_common() function.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #10417
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
In Illumos it is possible to call ioctl functions from within the
kernel by passing the FKIOCTL flag. Neither FreeBSD nor Linux support
that, but it doesn't hurt to keep it around, as all the code is there.

Before this commit it was a dead code and zc_iflags was always zero.
Restore this functionality by allowing to pass a flag to the
zfsdev_ioctl_common() function.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Pawel Jakub Dawidek <pawel@dawidek.net>
Closes openzfs#10417
sempervictus pushed a commit to sempervictus/zfs that referenced this pull request May 31, 2021
In Illumos it is possible to call ioctl functions from within the
kernel by passing the FKIOCTL flag. Neither FreeBSD nor Linux support
that, but it doesn't hurt to keep it around, as all the code is there.

Before this commit it was a dead code and zc_iflags was always zero.
Restore this functionality by allowing to pass a flag to the
zfsdev_ioctl_common() function.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Pawel Jakub Dawidek <pawel@dawidek.net>
Closes openzfs#10417
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants