[lxc-devel] [RFC PATCH 07/11] block: Make partitions inherit namespace from whole disk device
Seth Forshee
seth.forshee at canonical.com
Wed May 14 21:34:55 UTC 2014
When adding block devices for paritions the devices default to
ownership by init_user_ns. Instead assign them to the same
namespace as the device for the whole disk.
Signed-off-by: Seth Forshee <seth.forshee at canonical.com>
---
block/partition-generic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/partition-generic.c b/block/partition-generic.c
index 789cdea05893..7c1c83a072a6 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -17,6 +17,7 @@
#include <linux/ctype.h>
#include <linux/genhd.h>
#include <linux/blktrace_api.h>
+#include <linux/user_namesapce.h>
#include "partitions/check.h"
@@ -325,6 +326,7 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
pdev->class = &block_class;
pdev->type = &part_type;
pdev->parent = ddev;
+ dev_set_ns(pdev, ddev->ns);
err = blk_alloc_devt(p, &devt);
if (err)
--
1.9.1
More information about the lxc-devel
mailing list