From bbf631d046e171d78bd9eaefda24a9a0107c72f4 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 15 Feb 2019 19:19:00 +0100 Subject: [PATCH] fuse-overlays: fix interaction of unlink(2) with readdir(2) fix an interesting interaction between unlink(2) and readdir(2) that can confuse the cache. If a file is unlinked before the readdir(2) is done, it is not removed from the list generated when the directory was first opened. Thus the result is that readdir(2) will return the file even if it was unlinked and moved to the work dir until the cache is released. The fix is to skip dentries that are hidden while iterating the list. Closes: https://github.com/containers/libpod/issues/2342 Signed-off-by: Giuseppe Scrivano --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index ddc930b..67c540e 100644 --- a/main.c +++ b/main.c @@ -1486,7 +1486,7 @@ ovl_do_readdir (fuse_req_t req, fuse_ino_t ino, size_t size, const char *name; struct ovl_node *node = d->tbl[offset]; - if (node == NULL || node->whiteout) + if (node == NULL || node->whiteout || node->hidden) continue; ret = rpl_stat (req, node, &st);