From owner-svn-src-projects@freebsd.org Fri Apr 5 03:37:19 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 F321F1567295 for ; Fri, 5 Apr 2019 03:37:18 +0000 (UTC) (envelope-from ngie@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 8F5CA73498; Fri, 5 Apr 2019 03:37:18 +0000 (UTC) (envelope-from ngie@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 690FC75C9; Fri, 5 Apr 2019 03:37:18 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x353bIaW058118; Fri, 5 Apr 2019 03:37:18 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x353bHmX058112; Fri, 5 Apr 2019 03:37:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201904050337.x353bHmX058112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Fri, 5 Apr 2019 03:37:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r345904 - in projects/fuse2-googletest-engine: contrib/googletest/googletest/test sys/fs/fuse tests/sys/fs/fusefs X-SVN-Group: projects X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in projects/fuse2-googletest-engine: contrib/googletest/googletest/test sys/fs/fuse tests/sys/fs/fusefs X-SVN-Commit-Revision: 345904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8F5CA73498 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; 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, 05 Apr 2019 03:37:19 -0000 Author: ngie Date: Fri Apr 5 03:37:16 2019 New Revision: 345904 URL: https://svnweb.freebsd.org/changeset/base/345904 Log: MFprojects/fuse2@r345903 Added: projects/fuse2-googletest-engine/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc - copied unchanged from r345903, projects/fuse2/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc Modified: projects/fuse2-googletest-engine/sys/fs/fuse/fuse_file.c projects/fuse2-googletest-engine/sys/fs/fuse/fuse_file.h projects/fuse2-googletest-engine/sys/fs/fuse/fuse_ipc.c projects/fuse2-googletest-engine/sys/fs/fuse/fuse_node.c projects/fuse2-googletest-engine/sys/fs/fuse/fuse_vnops.c projects/fuse2-googletest-engine/tests/sys/fs/fusefs/read.cc Directory Properties: projects/fuse2-googletest-engine/ (props changed) Copied: projects/fuse2-googletest-engine/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc (from r345903, projects/fuse2/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/fuse2-googletest-engine/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc Fri Apr 5 03:37:16 2019 (r345904, copy of r345903, projects/fuse2/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc) @@ -0,0 +1,60 @@ +// Copyright 2019, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// This test verifies that skipping in the environment results in the +// testcases being skipped. +// +// This is a reproduction case for +// https://github.com/google/googletest/issues/2189 . + +#include +#include + +class SetupEnvironment : public testing::Environment { +public: + void SetUp() override { + GTEST_SKIP() << "Skipping the entire environment"; + } +}; + +TEST(Test, AlwaysPasses) { + EXPECT_EQ(true, true); +} + +TEST(Test, AlwaysFails) { + EXPECT_EQ(true, false); +} + +int main(int argc, char **argv) { + testing::InitGoogleTest(&argc, argv); + + testing::AddGlobalTestEnvironment(new SetupEnvironment()); + + return (RUN_ALL_TESTS()); +} Modified: projects/fuse2-googletest-engine/sys/fs/fuse/fuse_file.c ============================================================================== --- projects/fuse2-googletest-engine/sys/fs/fuse/fuse_file.c Fri Apr 5 03:35:40 2019 (r345903) +++ projects/fuse2-googletest-engine/sys/fs/fuse/fuse_file.c Fri Apr 5 03:37:16 2019 (r345904) @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include "fuse.h" #include "fuse_file.h" #include "fuse_internal.h" +#include "fuse_io.h" #include "fuse_ipc.h" #include "fuse_node.h" @@ -188,9 +189,7 @@ fuse_filehandle_open(struct vnode *vp, int a_mode, } foo = fdi.answ; - fuse_filehandle_init(vp, fufh_type, fufhp, td->td_proc->p_pid, cred, - foo); - + fuse_filehandle_init(vp, fufh_type, fufhp, td, cred, foo); fuse_vnode_open(vp, foo->open_flags, td); out: @@ -322,7 +321,7 @@ fuse_filehandle_getrw(struct vnode *vp, int fflag, void fuse_filehandle_init(struct vnode *vp, fufh_type_t fufh_type, - struct fuse_filehandle **fufhp, pid_t pid, struct ucred *cred, + struct fuse_filehandle **fufhp, struct thread *td, struct ucred *cred, struct fuse_open_out *foo) { struct fuse_vnode_data *fvdat = VTOFUD(vp); @@ -335,7 +334,7 @@ fuse_filehandle_init(struct vnode *vp, fufh_type_t fuf fufh->fufh_type = fufh_type; fufh->gid = cred->cr_rgid; fufh->uid = cred->cr_uid; - fufh->pid = pid; + fufh->pid = td->td_proc->p_pid; fufh->fuse_open_flags = foo->open_flags; if (!FUFH_IS_VALID(fufh)) { panic("FUSE: init: invalid filehandle id (type=%d)", fufh_type); @@ -345,4 +344,15 @@ fuse_filehandle_init(struct vnode *vp, fufh_type_t fuf *fufhp = fufh; atomic_add_acq_int(&fuse_fh_count, 1); + + if (foo->open_flags & FOPEN_DIRECT_IO) { + ASSERT_VOP_ELOCKED(vp, __func__); + VTOFUD(vp)->flag |= FN_DIRECTIO; + fuse_io_invalbuf(vp, td); + } else { + if ((foo->open_flags & FOPEN_KEEP_CACHE) == 0) + fuse_io_invalbuf(vp, td); + VTOFUD(vp)->flag &= ~FN_DIRECTIO; + } + } Modified: projects/fuse2-googletest-engine/sys/fs/fuse/fuse_file.h ============================================================================== --- projects/fuse2-googletest-engine/sys/fs/fuse/fuse_file.h Fri Apr 5 03:35:40 2019 (r345903) +++ projects/fuse2-googletest-engine/sys/fs/fuse/fuse_file.h Fri Apr 5 03:37:16 2019 (r345904) @@ -158,7 +158,7 @@ int fuse_filehandle_getrw(struct vnode *vp, int fflag, pid_t pid); void fuse_filehandle_init(struct vnode *vp, fufh_type_t fufh_type, - struct fuse_filehandle **fufhp, pid_t pid, + struct fuse_filehandle **fufhp, struct thread *td, struct ucred *cred, struct fuse_open_out *foo); int fuse_filehandle_open(struct vnode *vp, int mode, struct fuse_filehandle **fufhp, struct thread *td, Modified: projects/fuse2-googletest-engine/sys/fs/fuse/fuse_ipc.c ============================================================================== --- projects/fuse2-googletest-engine/sys/fs/fuse/fuse_ipc.c Fri Apr 5 03:35:40 2019 (r345903) +++ projects/fuse2-googletest-engine/sys/fs/fuse/fuse_ipc.c Fri Apr 5 03:37:16 2019 (r345904) @@ -182,6 +182,11 @@ fiov_adjust(struct fuse_iov *fiov, size_t size) } fiov->allocated_size = FU_AT_LEAST(size); fiov->credit = fuse_iov_credit; + /* Clear data buffer after reallocation */ + bzero(fiov->base, size); + } else if (size > fiov->len) { + /* Clear newly extended portion of data buffer */ + bzero((char*)fiov->base + fiov->len, size - fiov->len); } fiov->len = size; } @@ -198,7 +203,6 @@ void fiov_refresh(struct fuse_iov *fiov) { fiov_adjust(fiov, 0); - bzero(fiov->base, fiov->len); } static int @@ -744,6 +748,8 @@ fdisp_refresh_pid(struct fuse_dispatcher *fdip, enum f struct mount *mp, uint64_t nid, pid_t pid, struct ucred *cred) { MPASS(fdip->tick); + MPASS2(sizeof(fdip->finh) + fdip->iosize <= fdip->tick->tk_ms_fiov.len, + "Must use fdisp_make_pid to increase the size of the fiov"); fticket_reset(fdip->tick); FUSE_DIMALLOC(&fdip->tick->tk_ms_fiov, fdip->finh, @@ -766,6 +772,7 @@ fdisp_make_pid(struct fuse_dispatcher *fdip, enum fuse fdip->tick = fuse_ticket_fetch(data); } + /* FUSE_DIMALLOC will bzero the fiovs when it enlarges them */ FUSE_DIMALLOC(&fdip->tick->tk_ms_fiov, fdip->finh, fdip->indata, fdip->iosize); Modified: projects/fuse2-googletest-engine/sys/fs/fuse/fuse_node.c ============================================================================== --- projects/fuse2-googletest-engine/sys/fs/fuse/fuse_node.c Fri Apr 5 03:35:40 2019 (r345903) +++ projects/fuse2-googletest-engine/sys/fs/fuse/fuse_node.c Fri Apr 5 03:37:16 2019 (r345904) @@ -329,16 +329,6 @@ fuse_vnode_open(struct vnode *vp, int32_t fuse_open_fl * * XXXIP: Handle fd based DIRECT_IO */ - if (fuse_open_flags & FOPEN_DIRECT_IO) { - ASSERT_VOP_ELOCKED(vp, __func__); - VTOFUD(vp)->flag |= FN_DIRECTIO; - fuse_io_invalbuf(vp, td); - } else { - if ((fuse_open_flags & FOPEN_KEEP_CACHE) == 0) - fuse_io_invalbuf(vp, td); - VTOFUD(vp)->flag &= ~FN_DIRECTIO; - } - if (vnode_vtype(vp) == VREG) { /* XXXIP prevent getattr, by using cached node size */ vnode_create_vobject(vp, 0, td); Modified: projects/fuse2-googletest-engine/sys/fs/fuse/fuse_vnops.c ============================================================================== --- projects/fuse2-googletest-engine/sys/fs/fuse/fuse_vnops.c Fri Apr 5 03:35:40 2019 (r345903) +++ projects/fuse2-googletest-engine/sys/fs/fuse/fuse_vnops.c Fri Apr 5 03:37:16 2019 (r345904) @@ -479,8 +479,7 @@ fuse_vnop_create(struct vop_create_args *ap) } ASSERT_VOP_ELOCKED(*vpp, "fuse_vnop_create"); - fuse_filehandle_init(*vpp, FUFH_RDWR, NULL, td->td_proc->p_pid, cred, - foo); + fuse_filehandle_init(*vpp, FUFH_RDWR, NULL, td, cred, foo); fuse_vnode_open(*vpp, foo->open_flags, td); cache_purge_negative(dvp); Modified: projects/fuse2-googletest-engine/tests/sys/fs/fusefs/read.cc ============================================================================== --- projects/fuse2-googletest-engine/tests/sys/fs/fusefs/read.cc Fri Apr 5 03:35:40 2019 (r345903) +++ projects/fuse2-googletest-engine/tests/sys/fs/fusefs/read.cc Fri Apr 5 03:37:16 2019 (r345904) @@ -398,8 +398,7 @@ TEST_F(Read, eio) * With the keep_cache option, the kernel may keep its read cache across * multiple open(2)s. */ -/* https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236560 */ -TEST_F(Read, DISABLED_keep_cache) +TEST_F(Read, keep_cache) { const char FULLPATH[] = "mountpoint/some_file.txt"; const char RELPATH[] = "some_file.txt"; @@ -410,7 +409,7 @@ TEST_F(Read, DISABLED_keep_cache) char buf[bufsize]; FuseTest::expect_lookup(RELPATH, ino, S_IFREG | 0644, bufsize, 2); - expect_open(ino, FOPEN_KEEP_CACHE, 1); + expect_open(ino, FOPEN_KEEP_CACHE, 2); expect_getattr(ino, bufsize); expect_read(ino, 0, bufsize, bufsize, CONTENTS); @@ -418,7 +417,7 @@ TEST_F(Read, DISABLED_keep_cache) ASSERT_LE(0, fd0) << strerror(errno); ASSERT_EQ(bufsize, read(fd0, buf, bufsize)) << strerror(errno); - fd1 = open(FULLPATH, O_RDONLY); + fd1 = open(FULLPATH, O_RDWR); ASSERT_LE(0, fd1) << strerror(errno); /* @@ -445,7 +444,7 @@ TEST_F(Read, keep_cache_disabled) char buf[bufsize]; FuseTest::expect_lookup(RELPATH, ino, S_IFREG | 0644, bufsize, 2); - expect_open(ino, FOPEN_KEEP_CACHE, 1); + expect_open(ino, 0, 2); expect_getattr(ino, bufsize); expect_read(ino, 0, bufsize, bufsize, CONTENTS); @@ -453,7 +452,7 @@ TEST_F(Read, keep_cache_disabled) ASSERT_LE(0, fd0) << strerror(errno); ASSERT_EQ(bufsize, read(fd0, buf, bufsize)) << strerror(errno); - fd1 = open(FULLPATH, O_RDONLY); + fd1 = open(FULLPATH, O_RDWR); ASSERT_LE(0, fd1) << strerror(errno); /*