The branch main has been updated by kib:

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

commit be44e986377780f533f961fe7c009b93379b4710
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2021-01-24 13:56:05 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2021-02-12 01:02:20 +0000

    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
---
 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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to