lkml.org 
[lkml]   [2015]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/4] fs: btrfs: set file->private data NULL after open() because we depend on it
Date
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


\
 
 \ /
  Last update: 2015-03-23 14:41    [W:0.319 / U:0.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site