[PATCH 3/4] fs: btrfs: set file->private data NULL after open() because we depend on it

From: Martin Kepplinger
Date: Mon Mar 23 2015 - 09:01:47 EST


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@xxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/