From owner-svn-src-projects@freebsd.org Thu Mar 21 22:17:11 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 A71871551548 for ; Thu, 21 Mar 2019 22:17:11 +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 4A9798340D; Thu, 21 Mar 2019 22:17:11 +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 07047F4AF; Thu, 21 Mar 2019 22:17:11 +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 x2LMHAsQ043310; Thu, 21 Mar 2019 22:17:10 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LMHALD043307; Thu, 21 Mar 2019 22:17:10 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201903212217.x2LMHALD043307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Thu, 21 Mar 2019 22:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r345392 - projects/fuse2/sys/fs/fuse X-SVN-Group: projects X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: projects/fuse2/sys/fs/fuse X-SVN-Commit-Revision: 345392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4A9798340D 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.974,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] 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: Thu, 21 Mar 2019 22:17:11 -0000 Author: asomers Date: Thu Mar 21 22:17:10 2019 New Revision: 345392 URL: https://svnweb.freebsd.org/changeset/base/345392 Log: fusefs: VOP_FSYNC should be synchronous -- sometimes I committed too hastily in r345390. There are cases, not directly reachable from userland, where VOP_FSYNC ought to be asynchronous. This commit fixes fusefs to handle VOP_FSYNC synchronously if and only if the VFS requests it. PR: 236474 X-MFC-With: 345390 Sponsored by: The FreeBSD Foundation Modified: projects/fuse2/sys/fs/fuse/fuse_internal.c projects/fuse2/sys/fs/fuse/fuse_internal.h projects/fuse2/sys/fs/fuse/fuse_vnops.c Modified: projects/fuse2/sys/fs/fuse/fuse_internal.c ============================================================================== --- projects/fuse2/sys/fs/fuse/fuse_internal.c Thu Mar 21 21:56:03 2019 (r345391) +++ projects/fuse2/sys/fs/fuse/fuse_internal.c Thu Mar 21 22:17:10 2019 (r345392) @@ -282,12 +282,13 @@ int fuse_internal_fsync(struct vnode *vp, struct thread *td, struct ucred *cred, - struct fuse_filehandle *fufh) + struct fuse_filehandle *fufh, + int waitfor) { int op = FUSE_FSYNC; struct fuse_fsync_in *ffsi; struct fuse_dispatcher fdi; - int err; + int err = 0; if (vnode_isdir(vp)) { op = FUSE_FSYNCDIR; @@ -299,7 +300,12 @@ fuse_internal_fsync(struct vnode *vp, ffsi->fsync_flags = 1; /* datasync */ - err = fdisp_wait_answ(&fdi); + if (waitfor == MNT_WAIT) { + err = fdisp_wait_answ(&fdi); + } else { + fuse_insert_callback(fdi.tick, fuse_internal_fsync_callback); + fuse_insert_message(fdi.tick); + } fdisp_destroy(&fdi); return err; Modified: projects/fuse2/sys/fs/fuse/fuse_internal.h ============================================================================== --- projects/fuse2/sys/fs/fuse/fuse_internal.h Thu Mar 21 21:56:03 2019 (r345391) +++ projects/fuse2/sys/fs/fuse/fuse_internal.h Thu Mar 21 22:17:10 2019 (r345392) @@ -199,7 +199,7 @@ void fuse_internal_cache_attrs(struct vnode *vp, struc /* fsync */ int fuse_internal_fsync(struct vnode *vp, struct thread *td, - struct ucred *cred, struct fuse_filehandle *fufh); + struct ucred *cred, struct fuse_filehandle *fufh, int waitfor); int fuse_internal_fsync_callback(struct fuse_ticket *tick, struct uio *uio); /* readdir */ Modified: projects/fuse2/sys/fs/fuse/fuse_vnops.c ============================================================================== --- projects/fuse2/sys/fs/fuse/fuse_vnops.c Thu Mar 21 21:56:03 2019 (r345391) +++ projects/fuse2/sys/fs/fuse/fuse_vnops.c Thu Mar 21 22:17:10 2019 (r345392) @@ -435,6 +435,7 @@ fuse_vnop_fsync(struct vop_fsync_args *ap) { struct vnode *vp = ap->a_vp; struct thread *td = ap->a_td; + int waitfor = ap->a_waitfor; struct fuse_filehandle *fufh; struct fuse_vnode_data *fvdat = VTOFUD(vp); @@ -454,7 +455,7 @@ fuse_vnop_fsync(struct vop_fsync_args *ap) for (type = 0; type < FUFH_MAXTYPE; type++) { fufh = &(fvdat->fufh[type]); if (FUFH_IS_VALID(fufh)) { - err = fuse_internal_fsync(vp, td, NULL, fufh); + err = fuse_internal_fsync(vp, td, NULL, fufh, waitfor); } }