From owner-svn-src-projects@freebsd.org Fri May 10 16:58:07 2019 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0EF615A77FF for ; Fri, 10 May 2019 16:58:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7575181720; Fri, 10 May 2019 16:58:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BAE171A0; Fri, 10 May 2019 16:58:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4AGw6b3093307; Fri, 10 May 2019 16:58:06 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4AGw58p093305; Fri, 10 May 2019 16:58:05 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201905101658.x4AGw58p093305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 10 May 2019 16:58:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r347444 - projects/fuse2/tests/sys/fs/fusefs X-SVN-Group: projects X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: projects/fuse2/tests/sys/fs/fusefs X-SVN-Commit-Revision: 347444 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7575181720 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.98)[-0.981,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.996,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 May 2019 16:58:07 -0000 Author: asomers Date: Fri May 10 16:58:05 2019 New Revision: 347444 URL: https://svnweb.freebsd.org/changeset/base/347444 Log: fusefs: fix intermittency in the Destroy.ok test The handler for FUSE_DESTROY must shut down the daemon. Sponsored by: The FreeBSD Foundation Modified: projects/fuse2/tests/sys/fs/fusefs/destroy.cc projects/fuse2/tests/sys/fs/fusefs/mockfs.cc projects/fuse2/tests/sys/fs/fusefs/mockfs.hh Modified: projects/fuse2/tests/sys/fs/fusefs/destroy.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/destroy.cc Fri May 10 16:51:36 2019 (r347443) +++ projects/fuse2/tests/sys/fs/fusefs/destroy.cc Fri May 10 16:58:05 2019 (r347444) @@ -42,8 +42,12 @@ void expect_destroy(int error) return (in->header.opcode == FUSE_DESTROY); }, Eq(true)), _) - ).WillOnce(Invoke(ReturnErrno(error))); -} + ).WillOnce(Invoke( ReturnImmediate([&](auto in, auto out) { + m_mock->m_quit = true; + out->header.len = sizeof(out->header); + out->header.unique = in->header.unique; + out->header.error = -error; + })));} }; Modified: projects/fuse2/tests/sys/fs/fusefs/mockfs.cc ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/mockfs.cc Fri May 10 16:51:36 2019 (r347443) +++ projects/fuse2/tests/sys/fs/fusefs/mockfs.cc Fri May 10 16:58:05 2019 (r347444) @@ -53,7 +53,6 @@ extern "C" { using namespace testing; int verbosity = 0; -static sig_atomic_t quit = 0; const char* opcode2opname(uint32_t opcode) { @@ -288,7 +287,7 @@ MockFS::MockFS(int max_readahead, bool allow_other, bo m_daemon_id = NULL; m_maxreadahead = max_readahead; - quit = 0; + m_quit = false; /* * Kyua sets pwd to a testcase-unique tempdir; no need to use @@ -399,7 +398,7 @@ void MockFS::init(uint32_t flags) { } void MockFS::kill_daemon() { - quit = 1; + m_quit = true; if (m_daemon_id != NULL) pthread_kill(m_daemon_id, SIGUSR1); // Closing the /dev/fuse file descriptor first allows unmount to @@ -415,10 +414,10 @@ void MockFS::loop() { in = (mockfs_buf_in*) malloc(sizeof(*in)); ASSERT_TRUE(in != NULL); - while (!quit) { + while (!m_quit) { bzero(in, sizeof(*in)); read_request(in); - if (quit) + if (m_quit) break; if (verbosity > 0) debug_fuseop(in); @@ -483,9 +482,9 @@ void MockFS::read_request(mockfs_buf_in *in) { ssize_t res; res = read(m_fuse_fd, in, sizeof(*in)); - if (res < 0 && !quit) + if (res < 0 && !m_quit) perror("read"); - ASSERT_TRUE(res >= (ssize_t)sizeof(in->header) || quit); + ASSERT_TRUE(res >= (ssize_t)sizeof(in->header) || m_quit); } void* MockFS::service(void *pthr_data) { Modified: projects/fuse2/tests/sys/fs/fusefs/mockfs.hh ============================================================================== --- projects/fuse2/tests/sys/fs/fusefs/mockfs.hh Fri May 10 16:51:36 2019 (r347443) +++ projects/fuse2/tests/sys/fs/fusefs/mockfs.hh Fri May 10 16:58:05 2019 (r347444) @@ -212,6 +212,9 @@ class MockFS { /* Maximum size of a FUSE_WRITE write */ uint32_t m_max_write; + /* Tell the daemon to shut down ASAP */ + bool m_quit; + /* Create a new mockfs and mount it to a tempdir */ MockFS(int max_readahead, bool allow_other, bool default_permissions, bool push_symlinks_in, bool ro,