linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ovl:support fsinotify on overlayfs.
@ 2016-07-07  7:37 zhangaihua1
  0 siblings, 0 replies; only message in thread
From: zhangaihua1 @ 2016-07-07  7:37 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel, linux-unionfs; +Cc: zhangaihua

From: zhangaihua <zhangaihua1@huawei.com>

fix the inode to suppoert fsinotify, the inode should point
to overlay rather than upper.

before patch:
[root@localhost bin]# ./inotify01
inotify01    1  TPASS  :  get event: wd=1 mask=4 cookie=0 len=0
inotify01    2  TFAIL  :  inotify01.c:185: didn't get event: mask=20
inotify01    3  TFAIL  :  inotify01.c:185: didn't get event: mask=1
inotify01    4  TFAIL  :  inotify01.c:185: didn't get event: mask=10
inotify01    5  TFAIL  :  inotify01.c:185: didn't get event: mask=20
inotify01    6  TFAIL  :  inotify01.c:185: didn't get event: mask=2
inotify01    7  TFAIL  :  inotify01.c:185: didn't get event: mask=8

after patch:
[root@localhost bin]# ./inotify01
inotify01    1  TPASS  :  get event: wd=1 mask=4 cookie=0 len=0
inotify01    2  TPASS  :  get event: wd=1 mask=20 cookie=0 len=0
inotify01    3  TPASS  :  get event: wd=1 mask=1 cookie=0 len=0
inotify01    4  TPASS  :  get event: wd=1 mask=10 cookie=0 len=0
inotify01    5  TPASS  :  get event: wd=1 mask=20 cookie=0 len=0
inotify01    6  TPASS  :  get event: wd=1 mask=2 cookie=0 len=0
inotify01    7  TPASS  :  get event: wd=1 mask=8 cookie=0 len=0

Signed-off-by: Aihua Zhang <zhangaihua1@huawei.com>
---
 include/linux/fsnotify.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 7ee1774..ccd8395 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -194,7 +194,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry)
 static inline void fsnotify_access(struct file *file)
 {
 	struct path *path = &file->f_path;
-	struct inode *inode = file_inode(file);
+	struct inode *inode = path->dentry->d_inode;
 	__u32 mask = FS_ACCESS;
 
 	if (S_ISDIR(inode->i_mode))
@@ -212,8 +212,8 @@ static inline void fsnotify_access(struct file *file)
 static inline void fsnotify_modify(struct file *file)
 {
 	struct path *path = &file->f_path;
-	struct inode *inode = file_inode(file);
+	struct inode *inode = path->dentry->d_inode;
	 __u32 mask = FS_MODIFY; 

 	if (S_ISDIR(inode->i_mode))
 		mask |= FS_ISDIR;
@@ -230,7 +230,7 @@ static inline void fsnotify_modify(struct file *file)
 static inline void fsnotify_open(struct file *file)
 {
 	struct path *path = &file->f_path;
-	struct inode *inode = file_inode(file);
+	struct inode *inode = path->dentry->d_inode;
 	__u32 mask = FS_OPEN;
 
 	if (S_ISDIR(inode->i_mode))
@@ -246,8 +246,8 @@ static inline void fsnotify_open(struct file *file)
 static inline void fsnotify_close(struct file *file)
 {
 	struct path *path = &file->f_path;
-	struct inode *inode = file_inode(file);
+	struct inode *inode = path->dentry->d_inode;
	fmode_t mode = file->f_mode;
 	__u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
 
 	if (S_ISDIR(inode->i_mode))
-- 
1.7.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-07-07  7:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-07  7:37 [PATCH] ovl:support fsinotify on overlayfs zhangaihua1

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).