Problem Description: do_sendfile in fs/read_write.c does not call fsnotify functions, unlike its neighbors. Manifests as a lack of inotify ACCESS event when a file is sent using sendfile(2). I am a kernel hacking newbie, but I came up with the following patch, which seems good enough for my purposes. j_eng in #kernel on irc.freenode.net suggests that unnamed sockets shouldn't have the MODIFY event fired, since they can't be watched with inotify anyway. --- /usr/src/linux-source-2.6.26-1-amd64/fs/read_write.c 2008-07-13 17:51:29.000000000 -0400 +++ linux-source-2.6.26/fs/read_write.c 2009-03-02 22:52:09.000000000 -0500 @@ -778,6 +778,8 @@ static ssize_t do_sendfile(int out_fd, i if (retval > 0) { add_rchar(current, retval); add_wchar(current, retval); + fsnotify_access(in_file->f_path.dentry); + fsnotify_modify(out_file->f_path.dentry); } inc_syscr(current);
Thanks. Please submit patches via email, not via bugzilla, as per Documentation/SubmittingPatches. Suitable recipients for this one are Jens Axboe <jens.axboe@oracle.com> Andrew Morton <akpm@linux-foundation.org>, linux-fsdevel@vger.kernel.org linux-kernel@vger.kernel.org
A patch referencing this bug report has been merged in Linux v3.8-rc1: commit a68c2f12b4b28994aaf622bbe5724b7258cc2fcf Author: Scott Wolchok <swolchok@umich.edu> Date: Thu Dec 20 15:05:52 2012 -0800 sendfile: allows bypassing of notifier events