ovl: invalidate readdir cache on changes to dir with origin
authorAmir Goldstein <amir73il@gmail.com>
Sun, 11 Apr 2021 09:22:23 +0000 (12:22 +0300)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 12 Apr 2021 10:00:37 +0000 (12:00 +0200)
commit65cd913ec9d9d71529665924c81015b7ab7d9381
tree31f5e916ea5ab8203f4a2450c3b6976e1dad5212
parent708fa01597fa002599756bf56a96d0de1677375c
ovl: invalidate readdir cache on changes to dir with origin

The test in ovl_dentry_version_inc() was out-dated and did not include
the case where readdir cache is used on a non-merge dir that has origin
xattr, indicating that it may contain leftover whiteouts.

To make the code more robust, use the same helper ovl_dir_is_real()
to determine if readdir cache should be used and if readdir cache should
be invalidated.

Fixes: b79e05aaa166 ("ovl: no direct iteration for dir with origin xattr")
Link: https://lore.kernel.org/linux-unionfs/CAOQ4uxht70nODhNHNwGFMSqDyOKLXOKrY0H6g849os4BQ7cokA@mail.gmail.com/
Cc: Chris Murphy <lists@colorremedies.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/overlayfs.h
fs/overlayfs/readdir.c
fs/overlayfs/util.c