From owner-svn-src-all@freebsd.org Fri Feb 15 22:51:11 2019 Return-Path: Delivered-To: svn-src-all@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 6439C14EC825; Fri, 15 Feb 2019 22:51:11 +0000 (UTC) (envelope-from cem@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 28F6489CFE; Fri, 15 Feb 2019 22:51:11 +0000 (UTC) (envelope-from cem@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 B0CF82538E; Fri, 15 Feb 2019 22:51:10 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1FMpA48016410; Fri, 15 Feb 2019 22:51:10 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1FMpAKe016404; Fri, 15 Feb 2019 22:51:10 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201902152251.x1FMpAKe016404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 15 Feb 2019 22:51:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344185 - head/sys/fs/fuse X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/fs/fuse X-SVN-Commit-Revision: 344185 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 28F6489CFE 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.997,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Feb 2019 22:51:11 -0000 Author: cem Date: Fri Feb 15 22:51:09 2019 New Revision: 344185 URL: https://svnweb.freebsd.org/changeset/base/344185 Log: FUSE: Only "dirty" cached file size when data is dirty Most users of fuse_vnode_setsize() set the cached fvdat->filesize and update the buf cache bounds as a result of either a read from the underlying FUSE filesystem, or as part of a write-through type operation (like truncate => VOP_SETATTR). In these cases, do not set the FN_SIZECHANGE flag, which indicates that an inode's data is dirty (in particular, that the local buf cache and fvdat->filesize have dirty extended data). PR: 230258 (related) Modified: head/sys/fs/fuse/fuse_io.c head/sys/fs/fuse/fuse_node.c head/sys/fs/fuse/fuse_vnops.c Modified: head/sys/fs/fuse/fuse_io.c ============================================================================== --- head/sys/fs/fuse/fuse_io.c Fri Feb 15 22:50:31 2019 (r344184) +++ head/sys/fs/fuse/fuse_io.c Fri Feb 15 22:51:09 2019 (r344185) @@ -362,8 +362,11 @@ fuse_write_directbackend(struct vnode *vp, struct uio } uio->uio_resid += diff; uio->uio_offset -= diff; - if (uio->uio_offset > fvdat->filesize) + if (uio->uio_offset > fvdat->filesize && + fuse_data_cache_enable) { fuse_vnode_setsize(vp, cred, uio->uio_offset); + fvdat->flag &= ~FN_SIZECHANGE; + } } fdisp_destroy(&fdi); Modified: head/sys/fs/fuse/fuse_node.c ============================================================================== --- head/sys/fs/fuse/fuse_node.c Fri Feb 15 22:50:31 2019 (r344184) +++ head/sys/fs/fuse/fuse_node.c Fri Feb 15 22:51:09 2019 (r344185) @@ -375,6 +375,7 @@ fuse_vnode_refreshsize(struct vnode *vp, struct ucred struct vattr va; if ((fvdat->flag & FN_SIZECHANGE) != 0 || + fuse_data_cache_enable == 0 || (fuse_refresh_size == 0 && fvdat->filesize != 0)) return; Modified: head/sys/fs/fuse/fuse_vnops.c ============================================================================== --- head/sys/fs/fuse/fuse_vnops.c Fri Feb 15 22:50:31 2019 (r344184) +++ head/sys/fs/fuse/fuse_vnops.c Fri Feb 15 22:51:09 2019 (r344185) @@ -538,6 +538,7 @@ fuse_vnop_getattr(struct vop_getattr_args *ap) if (fvdat->filesize != new_filesize) { fuse_vnode_setsize(vp, cred, new_filesize); + fvdat->flag &= ~FN_SIZECHANGE; } } debug_printf("fuse_getattr e: returning 0\n"); @@ -1637,9 +1638,9 @@ fuse_vnop_setattr(struct vop_setattr_args *ap) err = EAGAIN; } } - if (!err && !sizechanged) { + if (err == 0) cache_attrs(vp, (struct fuse_attr_out *)fdi.answ, NULL); - } + out: fdisp_destroy(&fdi); if (!err && sizechanged) {