Mercurial > illumos > illumos-gate
changeset 849:8d799fd81a9b
6345023 /dev/zfs fails to open once ZFS module is unloaded
6345214 zfs IO buffers shouldn't get KMF_ flags on debug kernels
author | bonwick |
---|---|
date | Fri, 04 Nov 2005 22:44:23 -0800 |
parents | f7d66b0d32d5 |
children | 504be1e0fe28 |
files | usr/src/common/zfs/zfs_prop.c usr/src/lib/libzfs/common/libzfs_dataset.c usr/src/lib/libzpool/common/sys/zfs_context.h usr/src/uts/common/fs/zfs/sys/zfs_ioctl.h usr/src/uts/common/fs/zfs/zfs_ioctl.c usr/src/uts/common/fs/zfs/zfs_vfsops.c usr/src/uts/common/fs/zfs/zio.c usr/src/uts/common/fs/zfs/zvol.c |
diffstat | 8 files changed, 43 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/common/zfs/zfs_prop.c Fri Nov 04 17:51:12 2005 -0800 +++ b/usr/src/common/zfs/zfs_prop.c Fri Nov 04 22:44:23 2005 -0800 @@ -140,7 +140,8 @@ { "zoned", prop_type_boolean, 0, NULL, prop_inherit, ZFS_TYPE_ANY, "on | off", "ZONED", "%5s" }, - { "snapdir", prop_type_index, VISIBLE, NULL, prop_inherit, + { "snapdir", prop_type_index, ZFS_SNAPDIR_VISIBLE, NULL, + prop_inherit, ZFS_TYPE_FILESYSTEM, "hidden | visible", "SNAPDIR", "%7s" }, { "aclmode", prop_type_index, GROUPMASK, NULL, prop_inherit,
--- a/usr/src/lib/libzfs/common/libzfs_dataset.c Fri Nov 04 17:51:12 2005 -0800 +++ b/usr/src/lib/libzfs/common/libzfs_dataset.c Fri Nov 04 22:44:23 2005 -0800 @@ -355,8 +355,8 @@ const char *name; uint64_t value; } snapdir_table[] = { - { "hidden", HIDDEN }, - { "visible", VISIBLE }, + { "hidden", ZFS_SNAPDIR_HIDDEN }, + { "visible", ZFS_SNAPDIR_VISIBLE }, { NULL } };
--- a/usr/src/lib/libzpool/common/sys/zfs_context.h Fri Nov 04 17:51:12 2005 -0800 +++ b/usr/src/lib/libzpool/common/sys/zfs_context.h Fri Nov 04 22:44:23 2005 -0800 @@ -257,6 +257,7 @@ */ #define KM_SLEEP UMEM_NOFAIL #define KM_NOSLEEP UMEM_DEFAULT +#define KMC_NODEBUG UMC_NODEBUG #define kmem_alloc(_s, _f) umem_alloc(_s, _f) #define kmem_zalloc(_s, _f) umem_zalloc(_s, _f) #define kmem_free(_b, _s) umem_free(_b, _s)
--- a/usr/src/uts/common/fs/zfs/sys/zfs_ioctl.h Fri Nov 04 17:51:12 2005 -0800 +++ b/usr/src/uts/common/fs/zfs/sys/zfs_ioctl.h Fri Nov 04 22:44:23 2005 -0800 @@ -36,14 +36,11 @@ extern "C" { #endif -#define ZFS_DRIVER_NAME "zfs" -#define ZFS_DS_TYPE "zfs" - /* * Property values for snapdir */ -#define HIDDEN 0 -#define VISIBLE 1 +#define ZFS_SNAPDIR_HIDDEN 0 +#define ZFS_SNAPDIR_VISIBLE 1 typedef struct zfs_stats { uint64_t zs_atime; @@ -150,6 +147,9 @@ struct drr_begin zc_begin_record; } zfs_cmd_t; +#define ZVOL_MAX_MINOR (1 << 16) +#define ZFS_MIN_MINOR (ZVOL_MAX_MINOR + 1) + #ifdef _KERNEL extern dev_info_t *zfs_dip;
--- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c Fri Nov 04 17:51:12 2005 -0800 +++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c Fri Nov 04 22:44:23 2005 -0800 @@ -1216,7 +1216,7 @@ return (DDI_SUCCESS); case DDI_INFO_DEVT2INSTANCE: - *result = (void *)(uintptr_t)getminor((dev_t)arg); + *result = (void *)0; return (DDI_SUCCESS); } @@ -1282,16 +1282,20 @@ { int error; - if ((error = mod_install(&modlinkage)) != 0) + spa_init(FREAD | FWRITE); + zfs_init(); + zvol_init(); + + if ((error = mod_install(&modlinkage)) != 0) { + zvol_fini(); + zfs_fini(); + spa_fini(); return (error); + } error = ldi_ident_from_mod(&modlinkage, &zfs_li); ASSERT(error == 0); - spa_init(FREAD | FWRITE); - zfs_init(); - zvol_init(); - return (0); }
--- a/usr/src/uts/common/fs/zfs/zfs_vfsops.c Fri Nov 04 17:51:12 2005 -0800 +++ b/usr/src/uts/common/fs/zfs/zfs_vfsops.c Fri Nov 04 22:44:23 2005 -0800 @@ -53,10 +53,11 @@ #include <sys/modctl.h> #include <sys/zfs_ioctl.h> #include <sys/zfs_ctldir.h> +#include <sys/sunddi.h> int zfsfstype; vfsops_t *zfs_vfsops = NULL; -static major_t zfs_major; +static major_t zfs_major; static minor_t zfs_minor; static kmutex_t zfs_dev_mtx; @@ -380,7 +381,7 @@ zfsvfs->z_parent = zfsvfs; zfsvfs->z_assign = TXG_NOWAIT; zfsvfs->z_max_blksz = SPA_MAXBLOCKSIZE; - zfsvfs->z_show_ctldir = VISIBLE; + zfsvfs->z_show_ctldir = ZFS_SNAPDIR_VISIBLE; mutex_init(&zfsvfs->z_znodes_lock, NULL, MUTEX_DEFAULT, NULL); list_create(&zfsvfs->z_all_znodes, sizeof (znode_t), @@ -398,12 +399,23 @@ */ do { ASSERT3U(zfs_minor, <=, MAXMIN32); - int start = zfs_minor; + minor_t start = zfs_minor; do { mutex_enter(&zfs_dev_mtx); - zfs_minor++; - if (zfs_minor > MAXMIN32) - zfs_minor = 0; + if (zfs_minor >= MAXMIN32) { + /* + * If we're still using the real major number, + * keep out of /dev/zfs and /dev/zvol minor + * number space. If we're using a getudev()'ed + * major number, we can use all of its minors. + */ + if (zfs_major == ddi_name_to_major(ZFS_DRIVER)) + zfs_minor = ZFS_MIN_MINOR; + else + zfs_minor = 0; + } else { + zfs_minor++; + } mount_dev = makedevice(zfs_major, zfs_minor); mutex_exit(&zfs_dev_mtx); } while (vfs_devismounted(mount_dev) && zfs_minor != start); @@ -1018,16 +1030,11 @@ mutex_init(&zfs_dev_mtx, NULL, MUTEX_DEFAULT, NULL); /* - * unique major number for all zfs mounts + * Unique major number for all zfs mounts. + * If we run out of 32-bit minors, we'll getudev() another major. */ - if ((zfs_major = getudev()) == (major_t)-1) { - cmn_err(CE_WARN, - "zfs_vfsinit: Can't get unique device number."); - zfs_remove_op_tables(); - (void) vfs_freevfsops_by_type(zfsfstype); - return (error); - } - zfs_minor = 0; + zfs_major = ddi_name_to_major(ZFS_DRIVER); + zfs_minor = ZFS_MIN_MINOR; return (0); }
--- a/usr/src/uts/common/fs/zfs/zio.c Fri Nov 04 17:51:12 2005 -0800 +++ b/usr/src/uts/common/fs/zfs/zio.c Fri Nov 04 22:44:23 2005 -0800 @@ -117,7 +117,7 @@ char name[30]; (void) sprintf(name, "zio_buf_%lu", size); zio_buf_cache[c] = kmem_cache_create(name, size, - align, NULL, NULL, NULL, NULL, NULL, 0); + align, NULL, NULL, NULL, NULL, NULL, KMC_NODEBUG); dprintf("creating cache for size %5lx align %5lx\n", size, align); }