Date: Thu, 21 Mar 2019 22:17:10 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r345392 - projects/fuse2/sys/fs/fuse Message-ID: <201903212217.x2LMHALD043307@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903212217.x2LMHALD043307>