Linux 2.6.38 compat, blkdev_get_by_path()
[zfs.git] / module / zfs / zvol.c
index 6e92942..e4487f9 100644 (file)
@@ -44,6 +44,7 @@
 #include <sys/zfs_rlock.h>
 #include <sys/zfs_znode.h>
 #include <sys/zvol.h>
+#include <linux/blkdev_compat.h>
 
 unsigned int zvol_major = ZVOL_MAJOR;
 unsigned int zvol_threads = 0;
@@ -1002,6 +1003,8 @@ static int
 zvol_ioctl_by_inode(struct inode *inode, struct file *file,
                     unsigned int cmd, unsigned long arg)
 {
+       if (file == NULL || inode == NULL)
+               return -EINVAL;
        return zvol_ioctl(inode->i_bdev, file->f_mode, cmd, arg);
 }
 
@@ -1010,6 +1013,8 @@ static long
 zvol_compat_ioctl_by_inode(struct file *file,
                            unsigned int cmd, unsigned long arg)
 {
+       if (file == NULL)
+               return -EINVAL;
        return zvol_compat_ioctl(file->f_dentry->d_inode->i_bdev,
                                 file->f_mode, cmd, arg);
 }
@@ -1058,6 +1063,8 @@ zvol_alloc(dev_t dev, const char *name)
        mutex_init(&zv->zv_znode.z_range_lock, NULL, MUTEX_DEFAULT, NULL);
        avl_create(&zv->zv_znode.z_range_avl, zfs_range_compare,
            sizeof (rl_t), offsetof(rl_t, r_node));
+       zv->zv_znode.z_is_zvol = TRUE;
+
        spin_lock_init(&zv->zv_lock);
        list_link_init(&zv->zv_next);
 
@@ -1224,7 +1231,8 @@ zvol_create_minors_cb(spa_t *spa, uint64_t dsobj,
        if (strchr(dsname, '/') == NULL)
                return 0;
 
-       return __zvol_create_minor(dsname);
+       (void) __zvol_create_minor(dsname);
+       return (0);
 }
 
 /*