linux/fs/overlayfs
Amir Goldstein 764baba801 ovl: hash non-dir by lower inode for fsnotify
Commit 31747eda41 ("ovl: hash directory inodes for fsnotify")
fixed an issue of inotify watch on directory that stops getting
events after dropping dentry caches.

A similar issue exists for non-dir non-upper files, for example:

$ mkdir -p lower upper work merged
$ touch lower/foo
$ mount -t overlay -o
lowerdir=lower,workdir=work,upperdir=upper none merged
$ inotifywait merged/foo &
$ echo 2 > /proc/sys/vm/drop_caches
$ cat merged/foo

inotifywait doesn't get the OPEN event, because ovl_lookup() called
from 'cat' allocates a new overlay inode and does not reuse the
watched inode.

Fix this by hashing non-dir overlay inodes by lower real inode in
the following cases that were not hashed before this change:
 - A non-upper overlay mount
 - A lower non-hardlink when index=off

A helper ovl_hash_bylower() was added to put all the logic and
documentation about which real inode an overlay inode is hashed by
into one place.

The issue dates back to initial version of overlayfs, but this
patch depends on ovl_inode code that was introduced in kernel v4.13.

Cc: <stable@vger.kernel.org> #v4.13
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2018-02-16 15:53:20 +01:00
..
copy_up.c ovl: copy up of disconnected dentries 2018-01-24 11:25:58 +01:00
dir.c ovl: whiteout index when union nlink drops to zero 2018-01-24 11:25:56 +01:00
export.c ovl: check ERR_PTR() return value from ovl_encode_fh() 2018-02-05 09:50:29 +01:00
inode.c ovl: hash non-dir by lower inode for fsnotify 2018-02-16 15:53:20 +01:00
Kconfig ovl: add support for "nfs_export" configuration 2018-01-24 11:25:37 +01:00
Makefile ovl: encode pure upper file handles 2018-01-24 11:25:59 +01:00
namei.c ovl: fix regression in fsnotify of overlay merge dir 2018-02-05 09:50:29 +01:00
overlayfs.h ovl: lookup indexed ancestor of lower dir 2018-01-24 11:26:05 +01:00
ovl_entry.h ovl: store 'has_upper' and 'opaque' as bit flags 2018-01-24 11:25:58 +01:00
readdir.c ovl: whiteout orphan index entries on mount 2018-01-24 11:25:56 +01:00
super.c ovl: wire up NFS export operations 2018-01-24 11:26:06 +01:00
util.c ovl: store 'has_upper' and 'opaque' as bit flags 2018-01-24 11:25:58 +01:00