lkml.org 
[lkml]   [2014]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] ftruncate: create FAN_MODIFY and IN_MODIFY events
Date
The fanotify and the inotify API can be used to monitor changes of the file
system.

System call ftruncate modifies files. Hence it should trigger the corresponding
fanotify (FAN_MODIFY) and inotify (IN_MODIFY) events.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
fs/open.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/open.c b/fs/open.c
index d6fd3ac..e36f26e 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -189,6 +189,8 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
error = security_path_truncate(&f.file->f_path);
if (!error)
error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, f.file);
+ if (!error)
+ fsnotify_modify(f.file);
sb_end_write(inode->i_sb);
out_putf:
fdput(f);
--
2.1.0


\
 
 \ /
  Last update: 2014-10-03 20:41    [W:2.214 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site