The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=b7d2f7c1a68c270ae5f46b8cfcfb85aa792b6b12
commit b7d2f7c1a68c270ae5f46b8cfcfb85aa792b6b12 Author: Alan Somers <[email protected]> AuthorDate: 2026-06-23 20:42:25 +0000 Commit: Alan Somers <[email protected]> CommitDate: 2026-06-23 23:31:44 +0000 fusefs: fix two intermittency bugs in the destroy tests * Though undocumented, statfs(2) can sometimes return EBADF or ENOENT while an unmount is in progress. * In MockFS::write_response, write(2) may fail if m_fuse_fd has already been closed. This doesn't happen in the normal sequence of events, but it can happen if some process unrelated to the test nosily decides to access the test file system while it's being unmounted. PR: 296237 Reported by: siva MFC after: 2 weeks Sponsored by: ConnectWise Reviewed by: siva Differential Revision: https://reviews.freebsd.org/D57787 --- tests/sys/fs/fusefs/destroy.cc | 16 +++++++++++++++- tests/sys/fs/fusefs/mockfs.cc | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/sys/fs/fusefs/destroy.cc b/tests/sys/fs/fusefs/destroy.cc index 0c8e2fd22a50..fce3ed6ec78d 100644 --- a/tests/sys/fs/fusefs/destroy.cc +++ b/tests/sys/fs/fusefs/destroy.cc @@ -61,7 +61,21 @@ void assert_unmounted() { struct statfs statbuf; for (int retry = 100; retry > 0; retry--) { - ASSERT_EQ(0, statfs("mountpoint", &statbuf)) << strerror(errno); + if (0 != statfs("mountpoint", &statbuf)) { + switch (errno) { + case ENOENT: + case EBADF: + /* + * statfs will sometimes transiently return + * these errors while an unmount is in + * progress. Retry. + */ + nap(); + continue; + default: + FAIL() << "statfs:" << strerror(errno); + } + } if (strcmp("fusefs", statbuf.f_fstypename) != 0 && strcmp("/dev/fuse", statbuf.f_mntfromname) != 0) return; diff --git a/tests/sys/fs/fusefs/mockfs.cc b/tests/sys/fs/fusefs/mockfs.cc index 5cc7be9df611..bc49542ce1a4 100644 --- a/tests/sys/fs/fusefs/mockfs.cc +++ b/tests/sys/fs/fusefs/mockfs.cc @@ -1071,6 +1071,8 @@ void MockFS::write_response(const mockfs_buf_out &out) { if (out.expected_errno) { ASSERT_EQ(-1, r); ASSERT_EQ(out.expected_errno, errno) << strerror(errno); + } else if (m_quit && errno == EBADF) { + /* Daemon is in the process of shutting down */ } else { if (r <= 0 && errno == EINVAL) { printf("Failed to write response. unique=%" PRIu64
