From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755629AbcIPTH6 (ORCPT ); Fri, 16 Sep 2016 15:07:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:39196 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756494AbcIPTHv (ORCPT ); Fri, 16 Sep 2016 15:07:51 -0400 Date: Fri, 16 Sep 2016 18:38:07 +0200 From: Jan Kara To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, Aihua Zhang , linux-kernel@vger.kernel.org, Al Viro , Jan Kara , Eric Paris Subject: Re: [PATCH 04/12] fsnotify: support overlayfs Message-ID: <20160916163807.GD2433@quack2.suse.cz> References: <1474028371-21288-1-git-send-email-mszeredi@redhat.com> <1474028371-21288-5-git-send-email-mszeredi@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1474028371-21288-5-git-send-email-mszeredi@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 16-09-16 14:19:23, Miklos Szeredi wrote: > From: Aihua Zhang > > When an event occurs direct it to the overlay inode instead of the real > underlying inode. > > This will work even if the file was first on the lower layer and then > copied up, while the watch is there. This is because the watch is on the > overlay inode, which stays the same through the copy-up. > > For filesystems other than overlayfs this is a no-op, except for the > performance impact of an extra pointer dereferece. > > Verified to work correctly with the inotify/fanotify tests in LTP. > > Signed-off-by: Aihua Zhang > Signed-off-by: Miklos Szeredi > Cc: Jan Kara > Cc: Eric Paris > --- > include/linux/fsnotify.h | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h > index eed9e853a06f..b8bcc058e031 100644 > --- a/include/linux/fsnotify.h > +++ b/include/linux/fsnotify.h > @@ -29,7 +29,11 @@ static inline int fsnotify_parent(struct path *path, struct dentry *dentry, __u3 > static inline int fsnotify_perm(struct file *file, int mask) > { > struct path *path = &file->f_path; > - struct inode *inode = file_inode(file); > + /* > + * Do not use file_inode() here or anywhere in this file to get the > + * inode. That would break *notity on overlayfs. > + */ > + struct inode *inode = path->dentry->d_inode; So shouldn't we rather have d_backing_inode(path->dentry) here and everywhere else? Honza -- Jan Kara SUSE Labs, CR