debugfs: inode: debugfs_create_dir uses mode permission from parent
[muen/linux.git] / fs / debugfs / inode.c
index 13b01351dd1cb3f8381dbddd2ee70717792b9ac7..a913b12fc7f8db787e7b63a488cfe18733b27212 100644 (file)
@@ -512,7 +512,9 @@ struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
        if (unlikely(!inode))
                return failed_creating(dentry);
 
-       inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
+       if (!parent)
+               parent = debugfs_mount->mnt_root;
+       inode->i_mode = S_IFDIR | ((d_inode(parent)->i_mode & 0770));
        inode->i_op = &simple_dir_inode_operations;
        inode->i_fop = &simple_dir_operations;