--- linux-2.6.19-vs2.1.1.5/fs/block_dev.c 2006-11-08 21:52:09 +0100 +++ linux-2.6.19-vs2.1.1.5.1/fs/block_dev.c 2006-12-11 01:55:26 +0100 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "internal.h" @@ -414,6 +415,8 @@ EXPORT_SYMBOL(bdput); static struct block_device *bd_acquire(struct inode *inode) { struct block_device *bdev; + dev_t rdev; + int ret; spin_lock(&bdev_lock); bdev = inode->i_bdev; @@ -424,7 +427,13 @@ static struct block_device *bd_acquire(s } spin_unlock(&bdev_lock); - bdev = bdget(inode->i_rdev); + rdev = inode->i_rdev; + + ret = vs_map_device(current->vx_info, &rdev); + if (ret) + return NULL; + + bdev = bdget(rdev); if (bdev) { spin_lock(&bdev_lock); if (!inode->i_bdev) { --- linux-2.6.19-vs2.1.1.5/fs/char_dev.c 2006-11-07 03:19:14 +0100 +++ linux-2.6.19-vs2.1.1.5.1/fs/char_dev.c 2006-12-11 00:36:19 +0100 @@ -20,6 +20,7 @@ #include #include #include +#include #ifdef CONFIG_KMOD #include @@ -367,9 +368,15 @@ int chrdev_open(struct inode * inode, st p = inode->i_cdev; if (!p) { struct kobject *kobj; - int idx; + int idx, ret; + dev_t rdev = inode->i_rdev; + spin_unlock(&cdev_lock); - kobj = kobj_lookup(cdev_map, inode->i_rdev, &idx); + ret = vs_map_device(current->vx_info, &rdev); + if (ret) + return ret; + + kobj = kobj_lookup(cdev_map, rdev, &idx); if (!kobj) return -ENXIO; new = container_of(kobj, struct cdev, kobj); --- linux-2.6.19-vs2.1.1.5/include/linux/vserver/device.h 2006-12-08 01:36:02 +0100 +++ linux-2.6.19-vs2.1.1.5.1/include/linux/vserver/device.h 2006-12-11 00:35:54 +0100 @@ -7,6 +7,10 @@ #define DATTR_REMAP 0x00000010 +#define DATTR_CHR 0x00000100 + + +int vs_map_device(struct vx_info *, dev_t *); #else /* _VX_DEVICE_H */ #warning duplicate inclusion