From 5cc914bccc994fc573127a540d9a928f4ce33c0d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 1 Jul 2022 15:12:23 +0100 Subject: [PATCH] fuse/test-fuse.c: Partially disable test because of caching Previously we noted in a comment that stat("hello.txt") is cached (and not called again), so the test of the link count failed. Something has changed, possibly in the kernel, but it results in even more aggressive caching so that an earlier, similar test also fails in the same way. I checked by enabling debugging that the stat call doesn't result in guestfs_lstatns being called, and the old value for the statbuf was being returned. (cherry picked from commit f16fcdcfa25224ccd547e444d8a623f65c96f790) --- fuse/test-fuse.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fuse/test-fuse.c b/fuse/test-fuse.c index 64c2a1120..cfc531331 100644 --- a/fuse/test-fuse.c +++ b/fuse/test-fuse.c @@ -418,6 +418,14 @@ test_fuse (void) return -1; } +#if 0 + /* This fails because of caching. The problem is that the linked file + * ("hello.txt") is cached with a link count of 1. unlink("link") + * invalidates the cache for "link", but _not_ for "hello.txt" which + * still has the now-incorrect cached value. However there's not much + * we can do about this since searching for all linked inodes of a file + * is an O(n) operation. + */ if (stat ("hello.txt", &statbuf) == -1) { perror ("stat: hello.txt"); return -1; @@ -433,14 +441,6 @@ test_fuse (void) return -1; } -#if 0 - /* This fails because of caching. The problem is that the linked file - * ("hello.txt") is cached with a link count of 2. unlink("link") - * invalidates the cache for "link", but _not_ for "hello.txt" which - * still has the now-incorrect cached value. However there's not much - * we can do about this since searching for all linked inodes of a file - * is an O(n) operation. - */ if (stat ("hello.txt", &statbuf) == -1) { perror ("stat: hello.txt"); return -1;