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

Remove ZFS_IOC_*_MINOR ioctl()s #1969

Closed
wants to merge 4 commits into from

Conversation

behlendorf
Copy link
Contributor

Some overdue cleanup to bring the ZoL utilities back in sync with FreeBSD and Illumos in regards to zvol minor handling. Because this patch adjusts the ZFS kernel/user ioctl() ABI we wanted to get this work done prior to 0.6.3 being tagged because it already contains the libzfs_core ABI changes.

The patch stack also includes some additional zvol related cleanup and man page updates.

@behlendorf
Copy link
Contributor Author

@dweeezil I thought you might be interested in this since you did all the libzfs_core work. This should bring or minor handling back in sync with FreeBSD / Illumos.

@dweeezil
Copy link
Contributor

@behlendorf This looks good to me. While doing the libzfs_core work, and having to add minor creation in at least one place, I had wondered why it wasn't all done in the kernel. It's nice to get this re-aligned with Illumos and FreeBSD.

Early versions of ZFS coordinated the creation and destruction
of device minors from userspace.  This was inherently racy and
in late 2009 these ioctl()s were removed leaving everything up
to the kernel.  This significantly simplified the code.

However, we never picked up these changes in ZoL since we'd
already significantly adjusted this code for Linux.  This patch
aims to rectify that by finally removing ZFC_IOC_*_MINOR ioctl()s
and moving all the functionality down in to the kernel.  Since
this cleanup will change the kernel/user ABI it's being done
in the same tag as the previous libzfs_core ABI changes.  This
will minimize, but not eliminate, the disruption to end users.

Once merged ZoL, Illumos, and FreeBSD will basically be back
in sync in regards to handling ZVOLs in the common code.  While
each platform must have its own custom zvol.c implemenation the
interfaces provided are consistent.

NOTES:

1) This patch introduces one subtle change in behavior which
   could not be easily avoided.  Prior to this change callers
   of 'zfs create -V ...' were guaranteed that upon exit the
   /dev/zvol/ block device link would be created or an error
   returned.  That's no longer the case.  The utilities will no
   longer block waiting for the symlink to be created.  Callers
   are now responsible for blocking, this is why a 'udev_wait'
   call was added to the 'label' function in scripts/common.sh.

2) The read-only behavior of a ZVOL now solely depends on if
   the ZVOL_RDONLY bit is set in zv->zv_flags.  The redundant
   policy setting in the gendisk structure was removed.  This
   both simplifies the code and allows us to safely leverage
   set_disk_ro() to issue a KOBJ_CHANGE uevent.  See the
   comment in the code for futher details on this.

3) Because __zvol_create_minor() and zvol_alloc() may now be
   called in a sync task they must use KM_PUSHPAGE.

References:
  illumos-gate/illumos@681d9761e8516a7dc5ab6589e2dfe717777e1123

Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#1862
The Snapshots section of the zfs(8) man page is incorrect and should
have been updated as part of openzfs#1312.  Snapshots of volumes can be
accessed independently and their visibility is determined by the
'snapdev=hidden|visible' property.  This is analogous to the existing
'snapdir=hidden|visible' property.

Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#1921
Update zvol.c to conform to the style guidelines, verified by
running cstyle.pl on the source file.  This patch contains
no functional changes.

Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#1821
When running zconfig.sh test 7 and 8 cause the following warning to
be printed to the console.  It's caused because we're snapshoting a
mounted ext2 filesystem which is not in a 'clean' state.  This is
to be expected since we have no guarentees about the on-disk
consistency of the filesystem.

EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended

To silence the warning and preserve the intent of these test cases
they have been updated to unmount the filesystem prior to snapshoting
them.  This ensures the ext2 filesystem is in a consistent state
when the snapshot is taken.

Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#1972
@nedbass
Copy link
Contributor

nedbass commented Dec 13, 2013

The commit message for faac329 has illumos and illumos-gate transposed in the reference link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants