From owner-dev-commits-src-branches@freebsd.org Thu Feb 25 20:52:29 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53DD7548002; Thu, 25 Feb 2021 20:52:29 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DmlND5npwz3P7M; Thu, 25 Feb 2021 20:52:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 501CF1E349; Thu, 25 Feb 2021 20:52:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 11PKqPd6079364; Thu, 25 Feb 2021 20:52:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 11PKqPw3079363; Thu, 25 Feb 2021 20:52:25 GMT (envelope-from git) Date: Thu, 25 Feb 2021 20:52:25 GMT Message-Id: <202102252052.11PKqPw3079363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 9fc9a50119fa - releng/13.0 - ufs_rename: use VOP_VPUT_PAIR and rely on directory sync/truncation there MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 9fc9a50119fa65bce6612a634f161d9e7dbf9478 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2021 20:52:30 -0000 The branch releng/13.0 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9fc9a50119fa65bce6612a634f161d9e7dbf9478 commit 9fc9a50119fa65bce6612a634f161d9e7dbf9478 Author: Konstantin Belousov AuthorDate: 2021-01-28 13:34:56 +0000 Commit: Konstantin Belousov CommitDate: 2021-02-25 20:49:24 +0000 ufs_rename: use VOP_VPUT_PAIR and rely on directory sync/truncation there Approved by: re (delphij, gjb) (cherry picked from commit 038fe6e089f03ca864c1dd5ac0c76404a13bbe79) --- sys/ufs/ufs/ufs_vnops.c | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 70b5a44ca21d..c101e699bad6 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1676,38 +1676,16 @@ unlockout: vput(fdvp); vput(fvp); - if (tvp) - vput(tvp); + /* - * If compaction or fsync was requested do it now that other locks - * are no longer needed. + * If compaction or fsync was requested do it in + * ffs_vput_pair() now that other locks are no longer needed. */ if (error == 0 && endoff != 0) { - do { - error = UFS_TRUNCATE(tdvp, endoff, IO_NORMAL | - (DOINGASYNC(tdvp) ? 0 : IO_SYNC), tcnp->cn_cred); - } while (error == ERELOOKUP); - if (error != 0 && !ffs_fsfail_cleanup(VFSTOUFS(mp), error)) - vn_printf(tdvp, - "ufs_rename: failed to truncate, error %d\n", - error); -#ifdef UFS_DIRHASH - if (error != 0) - ufsdirhash_free(tdp); -#endif - /* - * Even if the directory compaction failed, rename was - * succesful. Do not propagate a UFS_TRUNCATE() error - * to the caller. - */ - error = 0; - } - if (error == 0 && tdp->i_flag & IN_NEEDSYNC) { - do { - error = VOP_FSYNC(tdvp, MNT_WAIT, td); - } while (error == ERELOOKUP); + UFS_INODE_SET_FLAG(tdp, IN_ENDOFF); + SET_I_ENDOFF(tdp, endoff); } - vput(tdvp); + VOP_VPUT_PAIR(tdvp, &tvp, true); return (error); bad: