Stop using v_mount of an unreferenced vnode -- save the mount while
the vnode has a reference.
This commit is contained in:
parent
fa96d3a82e
commit
690094cb2d
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: msdosfs_vnops.c,v 1.86 2013/03/18 19:35:37 plunky Exp $ */
|
/* $NetBSD: msdosfs_vnops.c,v 1.87 2013/11/02 10:30:18 hannken Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
|
||||||
@ -48,7 +48,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.86 2013/03/18 19:35:37 plunky Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.87 2013/11/02 10:30:18 hannken Exp $");
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
#include <sys/systm.h>
|
||||||
@ -829,6 +829,7 @@ msdosfs_rename(void *v)
|
|||||||
struct vnode *tdvp = ap->a_tdvp;
|
struct vnode *tdvp = ap->a_tdvp;
|
||||||
struct vnode *fvp = ap->a_fvp;
|
struct vnode *fvp = ap->a_fvp;
|
||||||
struct vnode *fdvp = ap->a_fdvp;
|
struct vnode *fdvp = ap->a_fdvp;
|
||||||
|
struct mount *mp = fdvp->v_mount;
|
||||||
struct componentname *tcnp = ap->a_tcnp;
|
struct componentname *tcnp = ap->a_tcnp;
|
||||||
struct componentname *fcnp = ap->a_fcnp;
|
struct componentname *fcnp = ap->a_fcnp;
|
||||||
struct denode *ip, *xp, *dp, *zp;
|
struct denode *ip, *xp, *dp, *zp;
|
||||||
@ -906,7 +907,7 @@ abortit:
|
|||||||
}
|
}
|
||||||
VN_KNOTE(fdvp, NOTE_WRITE); /* XXXLUKEM/XXX: right place? */
|
VN_KNOTE(fdvp, NOTE_WRITE); /* XXXLUKEM/XXX: right place? */
|
||||||
|
|
||||||
fstrans_start(fdvp->v_mount, FSTRANS_SHARED);
|
fstrans_start(mp, FSTRANS_SHARED);
|
||||||
/*
|
/*
|
||||||
* When the target exists, both the directory
|
* When the target exists, both the directory
|
||||||
* and target vnodes are returned locked.
|
* and target vnodes are returned locked.
|
||||||
@ -993,7 +994,7 @@ abortit:
|
|||||||
* file/directory.
|
* file/directory.
|
||||||
*/
|
*/
|
||||||
if ((error = uniqdosname(VTODE(tdvp), tcnp, toname)) != 0) {
|
if ((error = uniqdosname(VTODE(tdvp), tcnp, toname)) != 0) {
|
||||||
fstrans_done(fdvp->v_mount);
|
fstrans_done(mp);
|
||||||
goto abortit;
|
goto abortit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1009,7 +1010,7 @@ abortit:
|
|||||||
VOP_UNLOCK(fdvp);
|
VOP_UNLOCK(fdvp);
|
||||||
vrele(ap->a_fvp);
|
vrele(ap->a_fvp);
|
||||||
vrele(tdvp);
|
vrele(tdvp);
|
||||||
fstrans_done(fdvp->v_mount);
|
fstrans_done(mp);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
if (fvp == NULL) {
|
if (fvp == NULL) {
|
||||||
@ -1021,7 +1022,7 @@ abortit:
|
|||||||
vput(fdvp);
|
vput(fdvp);
|
||||||
vrele(ap->a_fvp);
|
vrele(ap->a_fvp);
|
||||||
vrele(tdvp);
|
vrele(tdvp);
|
||||||
fstrans_done(fdvp->v_mount);
|
fstrans_done(mp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
VOP_UNLOCK(fdvp);
|
VOP_UNLOCK(fdvp);
|
||||||
@ -1129,7 +1130,7 @@ bad:
|
|||||||
ip->de_flag &= ~DE_RENAME;
|
ip->de_flag &= ~DE_RENAME;
|
||||||
vrele(fdvp);
|
vrele(fdvp);
|
||||||
vrele(fvp);
|
vrele(fvp);
|
||||||
fstrans_done(fdvp->v_mount);
|
fstrans_done(mp);
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
/* XXX: uuuh */
|
/* XXX: uuuh */
|
||||||
@ -1291,6 +1292,7 @@ msdosfs_rmdir(void *v)
|
|||||||
} */ *ap = v;
|
} */ *ap = v;
|
||||||
struct vnode *vp = ap->a_vp;
|
struct vnode *vp = ap->a_vp;
|
||||||
struct vnode *dvp = ap->a_dvp;
|
struct vnode *dvp = ap->a_dvp;
|
||||||
|
struct mount *mp = dvp->v_mount;
|
||||||
struct componentname *cnp = ap->a_cnp;
|
struct componentname *cnp = ap->a_cnp;
|
||||||
struct denode *ip, *dp;
|
struct denode *ip, *dp;
|
||||||
int error;
|
int error;
|
||||||
@ -1305,7 +1307,7 @@ msdosfs_rmdir(void *v)
|
|||||||
vput(vp);
|
vput(vp);
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
fstrans_start(ap->a_dvp->v_mount, FSTRANS_SHARED);
|
fstrans_start(mp, FSTRANS_SHARED);
|
||||||
/*
|
/*
|
||||||
* Verify the directory is empty (and valid).
|
* Verify the directory is empty (and valid).
|
||||||
* (Rmdir ".." won't be valid since
|
* (Rmdir ".." won't be valid since
|
||||||
@ -1347,7 +1349,7 @@ out:
|
|||||||
if (dvp)
|
if (dvp)
|
||||||
vput(dvp);
|
vput(dvp);
|
||||||
vput(vp);
|
vput(vp);
|
||||||
fstrans_done(ap->a_dvp->v_mount);
|
fstrans_done(mp);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user