Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Mar 2019 16:08:07 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r345329 - projects/fuse2/tests/sys/fs/fuse
Message-ID:  <201903201608.x2KG87rb074251@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 	}
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903201608.x2KG87rb074251>