aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-01-24 13:56:05 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-02-12 01:02:20 +0000
commitbe44e986377780f533f961fe7c009b93379b4710 (patch)
treef8d3b4e4589e492fbb1e92d6af6a1e580cfa0c98 /sys
parent3b2aa36024abcb2d8fdbf3a6ecc7438b073b04e4 (diff)
downloadsrc-be44e986377780f533f961fe7c009b93379b4710.tar.gz
src-be44e986377780f533f961fe7c009b93379b4710.zip
ffs_snapshot: use VOP_VPUT_PAIR after VOP_CREATE.
If the snapshot embrio was reclaimed under us, return error outright. Reviewed by: chs, mckusick Tested by: pho MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys')
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c9
1 files 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);