]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-5.1/ovl-do-not-generate-duplicate-fsnotify-events-for-fa.patch
Drop watchdog patch
[thirdparty/kernel/stable-queue.git] / queue-5.1 / ovl-do-not-generate-duplicate-fsnotify-events-for-fa.patch
CommitLineData
d50b8c78
SL
1From b6c822d18d339702924f3d16d7d6c1dd9a61c4ff Mon Sep 17 00:00:00 2001
2From: Amir Goldstein <amir73il@gmail.com>
3Date: Wed, 24 Apr 2019 19:39:50 +0300
4Subject: ovl: do not generate duplicate fsnotify events for "fake" path
5
6[ Upstream commit d989903058a83e8536cc7aadf9256a47d5c173fe ]
7
8Overlayfs "fake" path is used for stacked file operations on underlying
9files. Operations on files with "fake" path must not generate fsnotify
10events with path data, because those events have already been generated at
11overlayfs layer and because the reported event->fd for fanotify marks on
12underlying inode/filesystem will have the wrong path (the overlayfs path).
13
14Link: https://lore.kernel.org/linux-fsdevel/20190423065024.12695-1-jencce.kernel@gmail.com/
15Reported-by: Murphy Zhou <jencce.kernel@gmail.com>
16Fixes: d1d04ef8572b ("ovl: stack file ops")
17Signed-off-by: Amir Goldstein <amir73il@gmail.com>
18Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
19Signed-off-by: Sasha Levin <sashal@kernel.org>
20---
21 fs/overlayfs/file.c | 7 ++++---
22 1 file changed, 4 insertions(+), 3 deletions(-)
23
24diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
25index 50e4407398d8..7129dcd78b6b 100644
26--- a/fs/overlayfs/file.c
27+++ b/fs/overlayfs/file.c
28@@ -29,10 +29,11 @@ static struct file *ovl_open_realfile(const struct file *file,
29 struct inode *inode = file_inode(file);
30 struct file *realfile;
31 const struct cred *old_cred;
32+ int flags = file->f_flags | O_NOATIME | FMODE_NONOTIFY;
33
34 old_cred = ovl_override_creds(inode->i_sb);
35- realfile = open_with_fake_path(&file->f_path, file->f_flags | O_NOATIME,
36- realinode, current_cred());
37+ realfile = open_with_fake_path(&file->f_path, flags, realinode,
38+ current_cred());
39 revert_creds(old_cred);
40
41 pr_debug("open(%p[%pD2/%c], 0%o) -> (%p, 0%o)\n",
42@@ -50,7 +51,7 @@ static int ovl_change_flags(struct file *file, unsigned int flags)
43 int err;
44
45 /* No atime modificaton on underlying */
46- flags |= O_NOATIME;
47+ flags |= O_NOATIME | FMODE_NONOTIFY;
48
49 /* If some flag changed that cannot be changed then something's amiss */
50 if (WARN_ON((file->f_flags ^ flags) & ~OVL_SETFL_MASK))
51--
522.20.1
53