diff options
| author | Alan Somers <asomers@FreeBSD.org> | 2022-04-02 19:31:24 +0000 |
|---|---|---|
| committer | Alan Somers <asomers@FreeBSD.org> | 2022-08-20 00:32:24 +0000 |
| commit | 4d5fb17274aa868561e99d714b75f0ddee446948 (patch) | |
| tree | f1df8c3942de145c1026f2e1a591506bddf48428 /tests/sys | |
| parent | a9d0655fa413ef10592815c9e123e6dc7b412b65 (diff) | |
Diffstat (limited to 'tests/sys')
| -rw-r--r-- | tests/sys/fs/fusefs/destroy.cc | 1 | ||||
| -rw-r--r-- | tests/sys/fs/fusefs/dev_fuse_poll.cc | 1 | ||||
| -rw-r--r-- | tests/sys/fs/fusefs/forget.cc | 33 | ||||
| -rw-r--r-- | tests/sys/fs/fusefs/lookup.cc | 2 |
4 files changed, 33 insertions, 4 deletions
diff --git a/tests/sys/fs/fusefs/destroy.cc b/tests/sys/fs/fusefs/destroy.cc index e72464382d4e..91c22ba6975e 100644 --- a/tests/sys/fs/fusefs/destroy.cc +++ b/tests/sys/fs/fusefs/destroy.cc @@ -141,7 +141,6 @@ TEST_F(Destroy, ok) uint64_t ino = 42; expect_lookup(RELPATH, ino, S_IFREG | 0644, 0, 2); - expect_forget(FUSE_ROOT_ID, 1); expect_forget(ino, 2); expect_destroy(0); diff --git a/tests/sys/fs/fusefs/dev_fuse_poll.cc b/tests/sys/fs/fusefs/dev_fuse_poll.cc index 951777701e1e..5ac66a915ea5 100644 --- a/tests/sys/fs/fusefs/dev_fuse_poll.cc +++ b/tests/sys/fs/fusefs/dev_fuse_poll.cc @@ -93,7 +93,6 @@ TEST_P(DevFusePoll, access) /* Ensure that we wake up pollers during unmount */ TEST_P(DevFusePoll, destroy) { - expect_forget(FUSE_ROOT_ID, 1); expect_destroy(0); m_mock->unmount(); diff --git a/tests/sys/fs/fusefs/forget.cc b/tests/sys/fs/fusefs/forget.cc index 6046739547e9..17160644c0f7 100644 --- a/tests/sys/fs/fusefs/forget.cc +++ b/tests/sys/fs/fusefs/forget.cc @@ -32,6 +32,7 @@ extern "C" { #include <sys/types.h> +#include <sys/mount.h> #include <sys/sysctl.h> #include <fcntl.h> @@ -144,3 +145,35 @@ TEST_F(Forget, invalidate_names) /* Access the file again, causing another lookup */ ASSERT_EQ(0, access(FULLFPATH, F_OK)) << strerror(errno); } + +/* + * Reclaiming the root inode should not send a FUSE_FORGET request, nor should + * it interfere with further lookup operations. + */ +TEST_F(Forget, root) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + uint64_t ino = 42; + mode_t mode = S_IFREG | 0755; + + EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH) + .WillRepeatedly(Invoke( + ReturnImmediate([=](auto in __unused, auto& out) { + SET_OUT_HEADER_LEN(out, entry); + out.body.entry.attr.mode = mode; + out.body.entry.nodeid = ino; + out.body.entry.attr.nlink = 1; + out.body.entry.attr_valid = UINT64_MAX; + out.body.entry.entry_valid = UINT64_MAX; + }))); + + /* access(2) the file to force a lookup. */ + ASSERT_EQ(0, access(FULLPATH, F_OK)) << strerror(errno); + + reclaim_vnode("mountpoint"); + nap(); + + /* Access it again, to make sure it's still possible. */ + ASSERT_EQ(0, access(FULLPATH, F_OK)) << strerror(errno); +} diff --git a/tests/sys/fs/fusefs/lookup.cc b/tests/sys/fs/fusefs/lookup.cc index 2dfa10730ec8..32e2a08eb949 100644 --- a/tests/sys/fs/fusefs/lookup.cc +++ b/tests/sys/fs/fusefs/lookup.cc @@ -263,7 +263,6 @@ TEST_F(Lookup, dotdot_no_parent_nid) ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { SET_OUT_HEADER_LEN(out, open); }))); - expect_forget(FUSE_ROOT_ID, 1, NULL); expect_forget(foo_ino, 1, NULL); fd = open("mountpoint/foo/bar", O_EXEC| O_DIRECTORY); @@ -574,7 +573,6 @@ TEST_F(LookupExportable, dotdot_no_parent_nid) ).WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { SET_OUT_HEADER_LEN(out, open); }))); - expect_forget(FUSE_ROOT_ID, 1, NULL); expect_forget(foo_ino, 1, NULL); EXPECT_LOOKUP(bar_ino, "..") .WillOnce(Invoke(ReturnImmediate([=](auto in __unused, auto& out) { |
