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
detect root node and set VROOT flag
[unix-history]
/
usr
/
src
/
sys
/
miscfs
/
union
/
union_subr.c
diff --git
a/usr/src/sys/miscfs/union/union_subr.c
b/usr/src/sys/miscfs/union/union_subr.c
index
eae9bff
..
f0cd58e
100644
(file)
--- a/
usr/src/sys/miscfs/union/union_subr.c
+++ b/
usr/src/sys/miscfs/union/union_subr.c
@@
-8,7
+8,7
@@
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)union_subr.c 8.
3
(Berkeley) %G%
+ * @(#)union_subr.c 8.
5
(Berkeley) %G%
*/
#include <sys/param.h>
*/
#include <sys/param.h>
@@
-21,6
+21,7
@@
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/queue.h>
#include <sys/file.h>
#include <sys/filedesc.h>
#include <sys/queue.h>
+#include <sys/mount.h>
#include <miscfs/union/union.h>
#ifdef DIAGNOSTIC
#include <miscfs/union/union.h>
#ifdef DIAGNOSTIC
@@
-200,7
+201,9
@@
union_allocvp(vpp, mp, undvp, dvp, cnp, uppervp, lowervp)
struct union_node *un;
struct union_node **pp;
struct vnode *xlowervp = NULLVP;
struct union_node *un;
struct union_node **pp;
struct vnode *xlowervp = NULLVP;
+ struct union_mount *um = MOUNTTOUNIONMOUNT(mp);
int hash;
int hash;
+ int vflag;
int try;
if (uppervp == NULLVP && lowervp == NULLVP)
int try;
if (uppervp == NULLVP && lowervp == NULLVP)
@@
-211,6
+214,17
@@
union_allocvp(vpp, mp, undvp, dvp, cnp, uppervp, lowervp)
lowervp = NULLVP;
}
lowervp = NULLVP;
}
+ /* detect the root vnode (and aliases) */
+ vflag = 0;
+ if ((uppervp == um->um_uppervp) &&
+ ((lowervp == NULLVP) || lowervp == um->um_lowervp)) {
+ if (lowervp == NULLVP) {
+ lowervp = um->um_lowervp;
+ VREF(lowervp);
+ }
+ vflag = VROOT;
+ }
+
loop:
for (try = 0; try < 3; try++) {
switch (try) {
loop:
for (try = 0; try < 3; try++) {
switch (try) {
@@
-370,6
+384,7
@@
loop:
MALLOC((*vpp)->v_data, void *, sizeof(struct union_node),
M_TEMP, M_WAITOK);
MALLOC((*vpp)->v_data, void *, sizeof(struct union_node),
M_TEMP, M_WAITOK);
+ (*vpp)->v_flag |= vflag;
if (uppervp)
(*vpp)->v_type = uppervp->v_type;
else
if (uppervp)
(*vpp)->v_type = uppervp->v_type;
else
@@
-558,7
+573,10
@@
union_mkshadow(um, dvp, cnp, vpp)
cn.cn_nameiop = CREATE;
cn.cn_flags = (LOCKPARENT|HASBUF|SAVENAME|SAVESTART|ISLASTCN);
cn.cn_proc = cnp->cn_proc;
cn.cn_nameiop = CREATE;
cn.cn_flags = (LOCKPARENT|HASBUF|SAVENAME|SAVESTART|ISLASTCN);
cn.cn_proc = cnp->cn_proc;
- cn.cn_cred = um->um_cred;
+ if (um->um_op == UNMNT_ABOVE)
+ cn.cn_cred = cnp->cn_cred;
+ else
+ cn.cn_cred = um->um_cred;
cn.cn_nameptr = cn.cn_pnbuf;
cn.cn_namelen = cnp->cn_namelen;
cn.cn_hash = cnp->cn_hash;
cn.cn_nameptr = cn.cn_pnbuf;
cn.cn_namelen = cnp->cn_namelen;
cn.cn_hash = cnp->cn_hash;