svn commit: r345329 - projects/fuse2/tests/sys/fs/fuse

Alan Somers asomers at FreeBSD.org
Wed Mar 20 16:08:08 UTC 2019


Author: asomers
Date: Wed Mar 20 16:08:07 2019
New Revision: 345329
URL: https://svnweb.freebsd.org/changeset/base/345329

Log:
  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

Modified:
  projects/fuse2/tests/sys/fs/fuse/mockfs.cc

Modified: projects/fuse2/tests/sys/fs/fuse/mockfs.cc
==============================================================================
--- projects/fuse2/tests/sys/fs/fuse/mockfs.cc	Wed Mar 20 15:37:40 2019	(r345328)
+++ projects/fuse2/tests/sys/fs/fuse/mockfs.cc	Wed Mar 20 16:08:07 2019	(r345329)
@@ -307,6 +307,10 @@ MockFS::MockFS(int max_readahead, bool push_symlinks_i
 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;
 	}
 }
 


More information about the svn-src-projects mailing list