Package: linux / 3.16.56-1+deb8u1

features/all/aufs3/aufs-implement-new-f_op-setfl.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
From: "J. R. Okajima" <hooanon05g@gmail.com>
Date: Sun, 28 Feb 2016 07:08:26 +0900
Subject: aufs: implement new f_op->setfl()
Origin: https://github.com/sfjro/aufs3-linux/commit/e3fb13540a9cc40f106a13bfe89460f251b1ca30
Bug-Debian: https://bugs.debian.org/627782

Propagate the file flags from the virtual aufs's file object to the real
fs's file object. The exception is FASYNC/O_ASYNC since f_op already has
->fasync().

Reported-by: Akihiro Suda <suda.kyoto@gmail.com>
Signed-off-by: J. R. Okajima <hooanon05g@gmail.com>
[bwh: Backported to aufs-3.16-20140908: open-code au_read_pre()]
---
 fs/aufs/f_op.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

--- a/fs/aufs/f_op.c
+++ b/fs/aufs/f_op.c
@@ -766,6 +766,32 @@ out:
 	return err;
 }
 
+static int aufs_setfl(struct file *file, unsigned long arg)
+{
+	int err;
+	struct file *h_file;
+	struct super_block *sb;
+
+	sb = file->f_dentry->d_sb;
+	si_read_lock(sb, AuLock_FLUSH | AuLock_NOPLMW);
+	err = au_reval_and_lock_fdi(file, au_reopen_nondir, /*wlock*/0);
+	if (err)
+		goto out;
+
+	di_read_unlock(file->f_dentry, AuLock_IR);
+	h_file = au_hf_top(file);
+	get_file(h_file);
+	fi_read_unlock(file);
+
+	arg |= vfsub_file_flags(file) & FASYNC; /* stop calling h_file->fasync */
+	err = setfl(/*unused fd*/-1, h_file, arg);
+	fput(h_file); /* instead of au_read_post() */
+
+out:
+	si_read_unlock(sb);
+	return err;
+}
+
 /* ---------------------------------------------------------------------- */
 
 /* no one supports this operation, currently */
@@ -803,6 +829,7 @@ const struct file_operations aufs_file_f
 	/* .aio_fsync	= aufs_aio_fsync_nondir, */
 	.fasync		= aufs_fasync,
 	/* .sendpage	= aufs_sendpage, */
+	.setfl		= aufs_setfl,
 	.splice_write	= aufs_splice_write,
 	.splice_read	= aufs_splice_read,
 #if 0