fusefs: fix intermittency in the default_permissions.Unlink.ok test

The test needs to expect a FUSE_FORGET operation. Most of the time the test
would pass anyway, because by chance FUSE_FORGET would arrive after the
unmount.

MFC after:	2 weeks
MFC-With:	350665
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Alan Somers 2019-08-14 18:04:04 +00:00
parent 4035e778f8
commit 331884f291
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=351039

View File

@ -40,6 +40,7 @@ extern "C" {
#include <sys/extattr.h>
#include <fcntl.h>
#include <semaphore.h>
#include <unistd.h>
}
@ -1157,12 +1158,19 @@ TEST_F(Unlink, ok)
const char FULLPATH[] = "mountpoint/some_file.txt";
const char RELPATH[] = "some_file.txt";
uint64_t ino = 42;
sem_t sem;
ASSERT_EQ(0, sem_init(&sem, 0, 0)) << strerror(errno);
expect_getattr(FUSE_ROOT_ID, S_IFDIR | 0777, UINT64_MAX, 1);
expect_lookup(RELPATH, ino, S_IFREG | 0644, UINT64_MAX, geteuid());
expect_unlink(FUSE_ROOT_ID, RELPATH, 0);
expect_forget(ino, 1, &sem);
ASSERT_EQ(0, unlink(FULLPATH)) << strerror(errno);
sem_wait(&sem);
sem_destroy(&sem);
}
/*