fuse(4): fix a race condition in the tests

Sometimes the fuse daemon doesn't die as soon as its /dev/fuse file
descriptor is closed; it needs to be unmounted first.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Alan Somers 2019-03-20 16:08:07 +00:00
parent 7e4844f7d9
commit 197f8aac00
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/fuse2/; revision=345329

View File

@ -307,6 +307,10 @@ MockFS::MockFS(int max_readahead, bool push_symlinks_in,
MockFS::~MockFS() {
kill_daemon();
::unmount("mountpoint", MNT_FORCE);
if (m_daemon_id != NULL) {
pthread_join(m_daemon_id, NULL);
m_daemon_id = NULL;
}
rmdir("mountpoint");
}
@ -353,8 +357,6 @@ void MockFS::kill_daemon() {
// to succeed even if the daemon doesn't correctly respond to
// commands during the unmount sequence.
close(m_fuse_fd);
pthread_join(m_daemon_id, NULL);
m_daemon_id = NULL;
}
}