summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2012-10-06 19:57:27 +0000
committeravg <avg@FreeBSD.org>2012-10-06 19:57:27 +0000
commitb84b597f7acedbe94a9dac4963137a33677e7e19 (patch)
tree0c07d150af9ee0a7afe6e99318ccc5be5325268e
parentda6a14b6d98952a1ebe93314410668a3edc53261 (diff)
downloadFreeBSD-src-b84b597f7acedbe94a9dac4963137a33677e7e19.zip
FreeBSD-src-b84b597f7acedbe94a9dac4963137a33677e7e19.tar.gz
zvol: set mediasize in geom provider right upon its creation
... instead of deferring the action until first open. Unlike upstream this has no benefit on FreeBSD. We know that as soon as the provider is created it is going to be tasted and thus opened. Initial mediasize of zero causes tasting failure and subsequent retasting because of the size change. MFC after: 14 days
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
index be4f518..07fd3c6 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
@@ -475,6 +475,7 @@ zvol_create_minor(const char *name)
zvol_state_t *zv;
objset_t *os;
dmu_object_info_t doi;
+ uint64_t volsize;
int error;
ZFS_LOG(1, "Creating ZVOL %s...", name);
@@ -535,9 +536,20 @@ zvol_create_minor(const char *name)
zv = zs->zss_data = kmem_zalloc(sizeof (zvol_state_t), KM_SLEEP);
#else /* !sun */
+ error = zap_lookup(os, ZVOL_ZAP_OBJ, "size", 8, 1, &volsize);
+ if (error) {
+ ASSERT(error == 0);
+ dmu_objset_disown(os, zvol_tag);
+ mutex_exit(&spa_namespace_lock);
+ return (error);
+ }
+
DROP_GIANT();
g_topology_lock();
zv = zvol_geom_create(name);
+ zv->zv_volsize = volsize;
+ zv->zv_provider->mediasize = zv->zv_volsize;
+
#endif /* !sun */
(void) strlcpy(zv->zv_name, name, MAXPATHLEN);
OpenPOWER on IntegriCloud