Date: Wed, 24 Feb 2021 07:58:53 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: e1e108f35102 - stable/13 - ufs_rename: use VOP_VPUT_PAIR and rely on directory sync/truncation there Message-ID: <202102240758.11O7wraZ046627@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e1e108f351026e9f06fdc18f0db2d657402b9fcf commit e1e108f351026e9f06fdc18f0db2d657402b9fcf Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-01-28 13:34:56 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-02-24 07:45:39 +0000 ufs_rename: use VOP_VPUT_PAIR and rely on directory sync/truncation there (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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102240758.11O7wraZ046627>