Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Feb 2021 20:52:19 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: 56119250bbfe - releng/13.0 - ffs_snapshot: use VOP_VPUT_PAIR after VOP_CREATE.
Message-ID:  <202102252052.11PKqJXO079255@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch releng/13.0 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=56119250bbfecee2121b309ecf7a61952c0c1998

commit 56119250bbfecee2121b309ecf7a61952c0c1998
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-01-24 13:56:05 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-02-25 20:48:47 +0000

    ffs_snapshot: use VOP_VPUT_PAIR after VOP_CREATE.
    
    Approved by:    re (delphij, gjb)
    
    (cherry picked from commit be44e986377780f533f961fe7c009b93379b4710)
---
 sys/ufs/ffs/ffs_snapshot.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index 32dc47653d18..b5daec14decf 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -296,16 +296,21 @@ restart:
 		goto restart;
 	}
 	error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vat);
-	VOP_UNLOCK(nd.ni_dvp);
 	if (error) {
+		VOP_VPUT_PAIR(nd.ni_dvp, NULL, true);
 		NDFREE(&nd, NDF_ONLY_PNBUF);
 		vn_finished_write(wrtmp);
-		vrele(nd.ni_dvp);
 		if (error == ERELOOKUP)
 			goto restart;
 		return (error);
 	}
 	vp = nd.ni_vp;
+	vref(nd.ni_dvp);
+	VOP_VPUT_PAIR(nd.ni_dvp, &vp, false);
+	if (VN_IS_DOOMED(vp)) {
+		error = EBADF;
+		goto out;
+	}
 	vnode_create_vobject(nd.ni_vp, fs->fs_size, td);
 	vp->v_vflag |= VV_SYSTEM;
 	ip = VTOI(vp);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102252052.11PKqJXO079255>