From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752704AbaJFNY4 (ORCPT ); Mon, 6 Oct 2014 09:24:56 -0400 Received: from cantor2.suse.de ([195.135.220.15]:50642 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752668AbaJFNYx (ORCPT ); Mon, 6 Oct 2014 09:24:53 -0400 Date: Mon, 6 Oct 2014 15:24:49 +0200 From: Jan Kara To: Heinrich Schuchardt Cc: Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Jan Kara , Eric Paris , Michael Kerrisk , John McCutchan , Robert Love Subject: Re: [PATCH 1/1] ftruncate: create FAN_MODIFY and IN_MODIFY events Message-ID: <20141006132449.GD7526@quack.suse.cz> References: <1412360190-1507-1-git-send-email-xypron.glpk@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1412360190-1507-1-git-send-email-xypron.glpk@gmx.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 03-10-14 20:16:30, Heinrich Schuchardt wrote: > 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. Hum, I would think that the appropriate event gets generated by fsnotify_change() called from notify_change()? Honza > > Signed-off-by: Heinrich Schuchardt > --- > 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 > -- Jan Kara SUSE Labs, CR