mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-18 02:20:59 +03:00
FreeBSD: Ignore make_dev_s() errors
Since errors returned by zvol_create_minor_impl() are ignored by the common code, it is more convenient to ignore make_dev_s() errors there. It allows, for example, to get device created for the zvol after later rename instead of having it further stuck in half-created state. zvol_rename_minor() already ignores those errors. While there, switch from MAXPHYS to maxphys in FreeBSD 13+. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tony Nguyen <tony.nguyen@delphix.com> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Closes #12375
This commit is contained in:
parent
eaa10257ca
commit
93e11e257b
@ -1241,7 +1241,11 @@ zvol_rename_minor(zvol_state_t *zv, const char *newname)
|
|||||||
args.mda_si_drv2 = zv;
|
args.mda_si_drv2 = zv;
|
||||||
if (make_dev_s(&args, &dev, "%s/%s", ZVOL_DRIVER, newname)
|
if (make_dev_s(&args, &dev, "%s/%s", ZVOL_DRIVER, newname)
|
||||||
== 0) {
|
== 0) {
|
||||||
|
#if __FreeBSD_version > 1300130
|
||||||
|
dev->si_iosize_max = maxphys;
|
||||||
|
#else
|
||||||
dev->si_iosize_max = MAXPHYS;
|
dev->si_iosize_max = MAXPHYS;
|
||||||
|
#endif
|
||||||
zsd->zsd_cdev = dev;
|
zsd->zsd_cdev = dev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1277,10 +1281,11 @@ zvol_free(zvol_state_t *zv)
|
|||||||
struct zvol_state_dev *zsd = &zv->zv_zso->zso_dev;
|
struct zvol_state_dev *zsd = &zv->zv_zso->zso_dev;
|
||||||
struct cdev *dev = zsd->zsd_cdev;
|
struct cdev *dev = zsd->zsd_cdev;
|
||||||
|
|
||||||
|
if (dev != NULL) {
|
||||||
ASSERT3P(dev->si_drv2, ==, NULL);
|
ASSERT3P(dev->si_drv2, ==, NULL);
|
||||||
|
|
||||||
destroy_dev(dev);
|
destroy_dev(dev);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mutex_destroy(&zv->zv_state_lock);
|
mutex_destroy(&zv->zv_state_lock);
|
||||||
dataset_kstats_destroy(&zv->zv_kstat);
|
dataset_kstats_destroy(&zv->zv_kstat);
|
||||||
@ -1374,17 +1379,16 @@ zvol_create_minor_impl(const char *name)
|
|||||||
args.mda_gid = GID_OPERATOR;
|
args.mda_gid = GID_OPERATOR;
|
||||||
args.mda_mode = 0640;
|
args.mda_mode = 0640;
|
||||||
args.mda_si_drv2 = zv;
|
args.mda_si_drv2 = zv;
|
||||||
error = make_dev_s(&args, &dev, "%s/%s", ZVOL_DRIVER, name);
|
if (make_dev_s(&args, &dev, "%s/%s", ZVOL_DRIVER, name)
|
||||||
if (error) {
|
== 0) {
|
||||||
kmem_free(zv->zv_zso, sizeof (struct zvol_state_os));
|
#if __FreeBSD_version > 1300130
|
||||||
mutex_destroy(&zv->zv_state_lock);
|
dev->si_iosize_max = maxphys;
|
||||||
kmem_free(zv, sizeof (*zv));
|
#else
|
||||||
dmu_objset_disown(os, B_TRUE, FTAG);
|
|
||||||
goto out_doi;
|
|
||||||
}
|
|
||||||
dev->si_iosize_max = MAXPHYS;
|
dev->si_iosize_max = MAXPHYS;
|
||||||
|
#endif
|
||||||
zsd->zsd_cdev = dev;
|
zsd->zsd_cdev = dev;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
(void) strlcpy(zv->zv_name, name, MAXPATHLEN);
|
(void) strlcpy(zv->zv_name, name, MAXPATHLEN);
|
||||||
rw_init(&zv->zv_suspend_lock, NULL, RW_DEFAULT, NULL);
|
rw_init(&zv->zv_suspend_lock, NULL, RW_DEFAULT, NULL);
|
||||||
zfs_rangelock_init(&zv->zv_rangelock, NULL, NULL);
|
zfs_rangelock_init(&zv->zv_rangelock, NULL, NULL);
|
||||||
@ -1456,6 +1460,7 @@ zvol_clear_private(zvol_state_t *zv)
|
|||||||
struct zvol_state_dev *zsd = &zv->zv_zso->zso_dev;
|
struct zvol_state_dev *zsd = &zv->zv_zso->zso_dev;
|
||||||
struct cdev *dev = zsd->zsd_cdev;
|
struct cdev *dev = zsd->zsd_cdev;
|
||||||
|
|
||||||
|
if (dev != NULL)
|
||||||
dev->si_drv2 = NULL;
|
dev->si_drv2 = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user