mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-01-14 17:22:05 +03:00
When destroying a zvol, it is not "unpublished" from the system (that is, /dev/zd* node removed) until zvol_os_free(). Under Linux, at the time del_gendisk() and put_disk() are called, the device node may still be have an active hold, from a userspace program or something inside the kernel (a partition probe). As it is currently, this can lead to calls to zvol_open() or zvol_release() while the zvol_state_t is partially or fully freed. zvol_open() has some protection against this by checking that private_data is NULL, but zvol_release does not. This implements a better ordering for all of this by adding a new OS-side method, zvol_os_remove_minor(), which is responsible for fully decoupling the "private" (OS-side) objects from the zvol_state_t. For Linux, that means calling put_disk(), nulling private_data, and freeing zv_zso. This takes the place of zvol_os_clear_private(), which was a nod in that direction but did not do enough, and did not do it early enough. Equivalent changes are made on the FreeBSD side to follow the API change. Sponsored-by: Klara, Inc. Sponsored-by: Railway Corporation Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Fedor Uporov <fuporov.vstack@gmail.com> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #17625 |
||
|---|---|---|
| .. | ||
| abd_os.c | ||
| arc_os.c | ||
| mmp_os.c | ||
| policy.c | ||
| qat_compress.c | ||
| qat_crypt.c | ||
| qat.c | ||
| spa_misc_os.c | ||
| trace.c | ||
| vdev_disk.c | ||
| vdev_label_os.c | ||
| vdev_raidz.c | ||
| zfs_acl.c | ||
| zfs_ctldir.c | ||
| zfs_debug.c | ||
| zfs_dir.c | ||
| zfs_file_os.c | ||
| zfs_ioctl_os.c | ||
| zfs_racct.c | ||
| zfs_sysfs.c | ||
| zfs_uio.c | ||
| zfs_vfsops.c | ||
| zfs_vnops_os.c | ||
| zfs_znode_os.c | ||
| zio_crypt.c | ||
| zpl_ctldir.c | ||
| zpl_export.c | ||
| zpl_file_range.c | ||
| zpl_file.c | ||
| zpl_inode.c | ||
| zpl_super.c | ||
| zpl_xattr.c | ||
| zvol_os.c | ||