Messages in this thread Patch in this message | | | From | Martin Kepplinger <> | Subject | [PATCH 3/4] fs: btrfs: set file->private data NULL after open() because we depend on it | Date | Mon, 23 Mar 2015 13:59:48 +0100 |
| |
We depend on private_data being NULL to record transaction ioctl start and end. This allows the misc core's misc_open() to do whatever it wants.
Signed-off-by: Martin Kepplinger <martink@posteo.de> --- fs/btrfs/super.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 05fef19..00dd2a6 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1993,6 +1993,16 @@ static int btrfs_show_devname(struct seq_file *m, struct dentry *root) return 0; } +static int btrfs_control_open(struct inode *inode, struct file *file) +{ + /* + * we use private_data in the transaction start ioctl to record + * it being started. + */ + file->private_data = NULL; + return 0; +} + static const struct super_operations btrfs_super_ops = { .drop_inode = btrfs_drop_inode, .evict_inode = btrfs_evict_inode, @@ -2013,6 +2023,7 @@ static const struct file_operations btrfs_ctl_fops = { .compat_ioctl = btrfs_control_ioctl, .owner = THIS_MODULE, .llseek = noop_llseek, + .open = btrfs_control_open, }; static struct miscdevice btrfs_misc = { -- 2.1.4
| |