projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix readdir for no-linear stacks
[unix-history]
/
usr
/
src
/
sys
/
miscfs
/
union
/
union_vnops.c
diff --git
a/usr/src/sys/miscfs/union/union_vnops.c
b/usr/src/sys/miscfs/union/union_vnops.c
index
81f81d1
..
fe82e16
100644
(file)
--- a/
usr/src/sys/miscfs/union/union_vnops.c
+++ b/
usr/src/sys/miscfs/union/union_vnops.c
@@
-8,7
+8,7
@@
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)union_vnops.c 8.2
0
(Berkeley) %G%
+ * @(#)union_vnops.c 8.2
2
(Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
@@
-311,7
+311,7
@@
union_lookup(ap)
VOP_UNLOCK(lowervp);
error = union_allocvp(ap->a_vpp, dvp->v_mount, dvp, upperdvp, cnp,
VOP_UNLOCK(lowervp);
error = union_allocvp(ap->a_vpp, dvp->v_mount, dvp, upperdvp, cnp,
- uppervp, lowervp);
+ uppervp, lowervp
, 1
);
if (error) {
if (uppervp != NULLVP)
if (error) {
if (uppervp != NULLVP)
@@
-342,11
+342,13
@@
union_create(ap)
if (dvp != NULLVP) {
int error;
struct vnode *vp;
if (dvp != NULLVP) {
int error;
struct vnode *vp;
+ struct mount *mp;
FIXUP(un);
VREF(dvp);
un->un_flags |= UN_KLOCK;
FIXUP(un);
VREF(dvp);
un->un_flags |= UN_KLOCK;
+ mp = ap->a_dvp->v_mount;
vput(ap->a_dvp);
error = VOP_CREATE(dvp, &vp, ap->a_cnp, ap->a_vap);
if (error)
vput(ap->a_dvp);
error = VOP_CREATE(dvp, &vp, ap->a_cnp, ap->a_vap);
if (error)
@@
-354,12
+356,13
@@
union_create(ap)
error = union_allocvp(
ap->a_vpp,
error = union_allocvp(
ap->a_vpp,
-
ap->a_dvp->v_mount
,
-
ap->a_dvp
,
+
mp
,
+
NULLVP
,
NULLVP,
ap->a_cnp,
vp,
NULLVP,
ap->a_cnp,
vp,
- NULLVP);
+ NULLVP,
+ 1);
if (error)
vput(vp);
return (error);
if (error)
vput(vp);
return (error);
@@
-401,11
+404,13
@@
union_mknod(ap)
if (dvp != NULLVP) {
int error;
struct vnode *vp;
if (dvp != NULLVP) {
int error;
struct vnode *vp;
+ struct mount *mp;
FIXUP(un);
VREF(dvp);
un->un_flags |= UN_KLOCK;
FIXUP(un);
VREF(dvp);
un->un_flags |= UN_KLOCK;
+ mp = ap->a_dvp->v_mount;
vput(ap->a_dvp);
error = VOP_MKNOD(dvp, &vp, ap->a_cnp, ap->a_vap);
if (error)
vput(ap->a_dvp);
error = VOP_MKNOD(dvp, &vp, ap->a_cnp, ap->a_vap);
if (error)
@@
-414,12
+419,13
@@
union_mknod(ap)
if (vp != NULLVP) {
error = union_allocvp(
ap->a_vpp,
if (vp != NULLVP) {
error = union_allocvp(
ap->a_vpp,
-
ap->a_dvp->v_mount
,
-
ap->a_dvp
,
+
mp
,
+
NULLVP
,
NULLVP,
ap->a_cnp,
vp,
NULLVP,
ap->a_cnp,
vp,
- NULLVP);
+ NULLVP,
+ 1);
if (error)
vput(vp);
}
if (error)
vput(vp);
}
@@
-614,9
+620,7
@@
union_getattr(ap)
}
if (vp != NULLVP) {
}
if (vp != NULLVP) {
- VOP_LOCK(vp);
error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p);
error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p);
- VOP_UNLOCK(vp);
if (error)
return (error);
union_newsize(ap->a_vp, VNOVAL, vap->va_size);
if (error)
return (error);
union_newsize(ap->a_vp, VNOVAL, vap->va_size);
@@
-865,6
+869,7
@@
union_remove(ap)
if (un->un_uppervp != NULLVP) {
struct vnode *dvp = dun->un_uppervp;
struct vnode *vp = un->un_uppervp;
if (un->un_uppervp != NULLVP) {
struct vnode *dvp = dun->un_uppervp;
struct vnode *vp = un->un_uppervp;
+ struct componentname *cnp = ap->a_cnp;
FIXUP(dun);
VREF(dvp);
FIXUP(dun);
VREF(dvp);
@@
-875,9
+880,9
@@
union_remove(ap)
un->un_flags |= UN_KLOCK;
vput(ap->a_vp);
un->un_flags |= UN_KLOCK;
vput(ap->a_vp);
- if (un
->un_lowervp != NULLVP
)
-
ap->a_
cnp->cn_flags |= DOWHITEOUT;
- error = VOP_REMOVE(dvp, vp,
ap->a_
cnp);
+ if (un
ion_dowhiteout(un, cnp->cn_cred, cnp->cn_proc)
)
+ cnp->cn_flags |= DOWHITEOUT;
+ error = VOP_REMOVE(dvp, vp, cnp);
if (!error)
union_removed_upper(un);
} else {
if (!error)
union_removed_upper(un);
} else {
@@
-1058,10
+1063,12
@@
union_mkdir(ap)
FIXUP(un);
VREF(dvp);
un->un_flags |= UN_KLOCK;
FIXUP(un);
VREF(dvp);
un->un_flags |= UN_KLOCK;
-
vput
(ap->a_dvp);
+
VOP_UNLOCK
(ap->a_dvp);
error = VOP_MKDIR(dvp, &vp, ap->a_cnp, ap->a_vap);
error = VOP_MKDIR(dvp, &vp, ap->a_cnp, ap->a_vap);
- if (error)
+ if (error) {
+ vrele(ap->a_dvp);
return (error);
return (error);
+ }
error = union_allocvp(
ap->a_vpp,
error = union_allocvp(
ap->a_vpp,
@@
-1070,7
+1077,9
@@
union_mkdir(ap)
NULLVP,
ap->a_cnp,
vp,
NULLVP,
ap->a_cnp,
vp,
- NULLVP);
+ NULLVP,
+ 1);
+ vrele(ap->a_dvp);
if (error)
vput(vp);
return (error);
if (error)
vput(vp);
return (error);
@@
-1098,6
+1107,7
@@
union_rmdir(ap)
if (un->un_uppervp != NULLVP) {
struct vnode *dvp = dun->un_uppervp;
struct vnode *vp = un->un_uppervp;
if (un->un_uppervp != NULLVP) {
struct vnode *dvp = dun->un_uppervp;
struct vnode *vp = un->un_uppervp;
+ struct componentname *cnp = ap->a_cnp;
FIXUP(dun);
VREF(dvp);
FIXUP(dun);
VREF(dvp);
@@
-1108,8
+1118,8
@@
union_rmdir(ap)
un->un_flags |= UN_KLOCK;
vput(ap->a_vp);
un->un_flags |= UN_KLOCK;
vput(ap->a_vp);
- if (un
->un_lowervp != NULLVP
)
-
ap->a_
cnp->cn_flags |= DOWHITEOUT;
+ if (un
ion_dowhiteout(un, cnp->cn_cred, cnp->cn_proc)
)
+ cnp->cn_flags |= DOWHITEOUT;
error = VOP_RMDIR(dvp, vp, ap->a_cnp);
if (!error)
union_removed_upper(un);
error = VOP_RMDIR(dvp, vp, ap->a_cnp);
if (!error)
union_removed_upper(un);
@@
-1243,6
+1253,7
@@
union_inactive(ap)
} */ *ap;
{
struct union_node *un = VTOUNION(ap->a_vp);
} */ *ap;
{
struct union_node *un = VTOUNION(ap->a_vp);
+ struct vnode **vpp;
/*
* Do nothing (and _don't_ bypass).
/*
* Do nothing (and _don't_ bypass).
@@
-1264,6
+1275,13
@@
union_inactive(ap)
panic("union: inactivating w/locked upper node");
#endif
panic("union: inactivating w/locked upper node");
#endif
+ if (un->un_dircache != 0) {
+ for (vpp = un->un_dircache; *vpp != NULLVP; vpp++)
+ vrele(*vpp);
+ free(un->un_dircache, M_TEMP);
+ un->un_dircache = 0;
+ }
+
if ((un->un_flags & UN_CACHED) == 0)
vgone(ap->a_vp);
if ((un->un_flags & UN_CACHED) == 0)
vgone(ap->a_vp);