Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

WIP: inotify: T2509: Watch underlying file inode on overlayfs #8

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions patches/kernel/0003-VyOS-fix-overlayfs-inotify-interaction.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From: Andrey Jr. Melnikov <[email protected]>
Date: Thu, 30 Jun 2016 14:04:20 +0300
Subject: [PATCH] Fix overlayfs inotify interaction

Fix overlayfs inotify interaction - use d_real_inode() helper
to resolve real (underlying) inode. Without this inotify is not functional on
overlayfs.

---
Runtime tested with inotifywait in monitor mode to confirm event generation.

cd /tmp/ && mkdir dest upper lower work
mount -t overlay none dest -o upperdir=upper/,lowerdir=lower/,workdir=work/
while /bin/true; do echo test >>/tmp/dest/lower-data; sleep 5; done &
inotifywait -m /tmp/dest/lower-data

fs/notify/inotify/inotify_user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index b8d08d0..592ce16 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -742,7 +742,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
goto fput_and_out;

/* inode held in place by reference to path; group by fget on fd */
- inode = path.dentry->d_inode;
+ inode = d_real_inode(path.dentry);
group = f.file->private_data;

/* create/update an inode mark */
--
2.8.1