Remove /zvol/ path component for zvol devices

As part of commit f162433deb the /zvol/
path component was added for zvol devices.  This ensured all zvol
devices would be created by udev in /dev/zvol/<pool>/<dataset>, as
opposed to the previous /dev/<pool>/<dataset> path.  Logically, it
was nice to organize them in a directory much like Solaris does.

However, while initial testing showed this to work fine with modern
kernels it does not appear to be supported under RHEL5.  The extra
path component triggers a NULL deref in create_dir().  Anyway, to
avoid having different zvol path names based on your kernel version
its more consistent simply to revert to the original naming convention.
If you really want the zvol component you can always add custom
udev rules to do exactly this.

We can revisiting this change again once we are willing to drop
support for RHEL5 and similar older distros.
This commit is contained in:
Brian Behlendorf 2010-08-09 11:06:00 -07:00
parent 7e693479b0
commit 5ce3b77ef8
3 changed files with 12 additions and 2 deletions

View File

@ -691,7 +691,7 @@ typedef struct ddt_histogram {
#define ZFS_DEV "/dev/zfs" #define ZFS_DEV "/dev/zfs"
/* general zvol path */ /* general zvol path */
#define ZVOL_DIR "/dev/zvol" #define ZVOL_DIR "/dev"
#define ZVOL_MAJOR 230 #define ZVOL_MAJOR 230
#define ZVOL_MINOR_BITS 4 #define ZVOL_MINOR_BITS 4

View File

@ -1072,6 +1072,15 @@ vdev_open_child(void *arg)
boolean_t boolean_t
vdev_uses_zvols(vdev_t *vd) vdev_uses_zvols(vdev_t *vd)
{ {
/*
* Stacking zpools on top of zvols is unsupported until we implement a method
* for determining if an arbitrary block device is a zvol without using the
* path. Solaris would check the 'zvol' path component but this does not
* exist in the Linux port, so we really should do something like stat the
* file and check the major number. This is complicated by the fact that
* we need to do this portably in user or kernel space.
*/
#if 0
int c; int c;
if (vd->vdev_path && strncmp(vd->vdev_path, ZVOL_DIR, if (vd->vdev_path && strncmp(vd->vdev_path, ZVOL_DIR,
@ -1080,6 +1089,7 @@ vdev_uses_zvols(vdev_t *vd)
for (c = 0; c < vd->vdev_children; c++) for (c = 0; c < vd->vdev_children; c++)
if (vdev_uses_zvols(vd->vdev_child[c])) if (vdev_uses_zvols(vd->vdev_child[c]))
return (B_TRUE); return (B_TRUE);
#endif
return (B_FALSE); return (B_FALSE);
} }

View File

@ -1066,7 +1066,7 @@ zvol_alloc(dev_t dev, const char *name)
zv->zv_disk->fops = &zvol_ops; zv->zv_disk->fops = &zvol_ops;
zv->zv_disk->private_data = zv; zv->zv_disk->private_data = zv;
zv->zv_disk->queue = zv->zv_queue; zv->zv_disk->queue = zv->zv_queue;
snprintf(zv->zv_disk->disk_name, DISK_NAME_LEN, "zvol/%s", name); snprintf(zv->zv_disk->disk_name, DISK_NAME_LEN, "%s", name);
return zv; return zv;