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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 07:50:35 +0000 (09:50 +0200)
commit0f8528c78fc8b49314c1b5f87ff770d0841e54c5
tree11b1dda5e4dabb672fb162db1bc956d5f9028773
parent082fa65bf60a51a8ac199b31d39b42737d42382a
ovl: invalidate readdir cache on changes to dir with origin

[ Upstream commit 65cd913ec9d9d71529665924c81015b7ab7d9381 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/overlayfs/overlayfs.h
fs/overlayfs/readdir.c
fs/overlayfs/util.c