@@ -416,6 +416,7 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
pdev->class = &block_class;
pdev->type = &part_type;
pdev->parent = ddev;
+ pdev->no_devnode = ddev->no_devnode;
err = blk_alloc_devt(p, &devt);
if (err)
@@ -111,7 +111,7 @@ int devtmpfs_create_node(struct device *dev)
const char *tmp = NULL;
struct req req;
- if (!thread)
+ if (!thread || dev->no_devnode)
return 0;
req.mode = 0;
@@ -138,7 +138,7 @@ int devtmpfs_delete_node(struct device *dev)
const char *tmp = NULL;
struct req req;
- if (!thread)
+ if (!thread || dev->no_devnode)
return 0;
req.name = device_get_devnode(dev, NULL, NULL, NULL, &tmp);
@@ -76,8 +76,10 @@ bool loopfs_wants_remove(const struct loop_device *lo)
void loopfs_init(struct gendisk *disk, struct inode *inode)
{
- if (loopfs_i_sb(inode))
+ if (loopfs_i_sb(inode)) {
disk->user_ns = loopfs_i_sb(inode)->s_user_ns;
+ disk_to_dev(disk)->no_devnode = true;
+ }
}
/**
@@ -523,6 +523,8 @@ struct dev_links_info {
* sync_state() callback.
* @dma_coherent: this particular device is dma coherent, even if the
* architecture supports non-coherent devices.
+ * @no_devnode: whether device nodes associated with this device are kept out
+ * of devtmpfs (e.g. due to separate filesystem)
*
* At the lowest level, every device in a Linux system is represented by an
* instance of struct device. The device structure contains the information
@@ -622,6 +624,7 @@ struct device {
defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)
bool dma_coherent:1;
#endif
+ bool no_devnode:1;
};
static inline struct device *kobj_to_dev(struct kobject *kobj)