Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153643019
D34468.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D34468.id.diff
View Options
diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c
--- a/sys/fs/ext2fs/ext2_vnops.c
+++ b/sys/fs/ext2fs/ext2_vnops.c
@@ -910,7 +910,7 @@
if (error)
goto out;
VREF(tdvp);
- error = vfs_relookup(tdvp, &tvp, tcnp);
+ error = vfs_relookup(tdvp, &tvp, tcnp, true);
if (error)
goto out;
vrele(tdvp);
@@ -1036,7 +1036,7 @@
fcnp->cn_flags &= ~MODMASK;
fcnp->cn_flags |= LOCKPARENT | LOCKLEAF;
VREF(fdvp);
- error = vfs_relookup(fdvp, &fvp, fcnp);
+ error = vfs_relookup(fdvp, &fvp, fcnp, true);
if (error == 0)
vrele(fdvp);
if (fvp != NULL) {
diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c
--- a/sys/fs/unionfs/union_subr.c
+++ b/sys/fs/unionfs/union_subr.c
@@ -662,6 +662,7 @@
char *path, int pathlen, u_long nameiop)
{
int error;
+ bool refstart;
cn->cn_namelen = pathlen;
cn->cn_pnbuf = path;
@@ -671,17 +672,20 @@
cn->cn_cred = cnp->cn_cred;
cn->cn_nameptr = cn->cn_pnbuf;
- if (nameiop == DELETE)
- cn->cn_flags |= (cnp->cn_flags & (DOWHITEOUT | SAVESTART));
- else if (RENAME == nameiop)
- cn->cn_flags |= (cnp->cn_flags & SAVESTART);
- else if (nameiop == CREATE)
+ refstart = false;
+ if (nameiop == DELETE) {
+ cn->cn_flags |= (cnp->cn_flags & DOWHITEOUT);
+ refstart = (cnp->cn_flags & SAVESTART) != 0;
+ } else if (RENAME == nameiop) {
+ refstart = (cnp->cn_flags & SAVESTART) != 0;
+ } else if (nameiop == CREATE) {
cn->cn_flags |= NOCACHE;
+ }
vref(dvp);
VOP_UNLOCK(dvp);
- if ((error = vfs_relookup(dvp, vpp, cn))) {
+ if ((error = vfs_relookup(dvp, vpp, cn, refstart))) {
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
} else
vrele(dvp);
@@ -1017,7 +1021,7 @@
NDPREINIT(&nd);
vref(udvp);
- if ((error = vfs_relookup(udvp, &vp, &nd.ni_cnd)) != 0)
+ if ((error = vfs_relookup(udvp, &vp, &nd.ni_cnd, false)) != 0)
goto unionfs_vn_create_on_upper_free_out2;
vrele(udvp);
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -1435,7 +1435,8 @@
* Used by lookup to re-acquire things.
*/
int
-vfs_relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp)
+vfs_relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
+ bool refstart)
{
struct vnode *dp = NULL; /* the directory we are searching */
int rdonly; /* lookup read-only flag bit */
@@ -1479,7 +1480,7 @@
VOP_UNLOCK(dp);
*vpp = dp;
/* XXX This should probably move to the top of function. */
- if (cnp->cn_flags & SAVESTART)
+ if (refstart)
panic("lookup: SAVESTART");
return (0);
}
@@ -1506,7 +1507,7 @@
goto bad;
}
/* ASSERT(dvp == ndp->ni_startdir) */
- if (cnp->cn_flags & SAVESTART)
+ if (refstart)
VREF(dvp);
if ((cnp->cn_flags & LOCKPARENT) == 0)
VOP_UNLOCK(dp);
@@ -1544,7 +1545,7 @@
("relookup: symlink found.\n"));
/* ASSERT(dvp == ndp->ni_startdir) */
- if (cnp->cn_flags & SAVESTART)
+ if (refstart)
VREF(dvp);
if ((cnp->cn_flags & LOCKLEAF) == 0)
diff --git a/sys/sys/namei.h b/sys/sys/namei.h
--- a/sys/sys/namei.h
+++ b/sys/sys/namei.h
@@ -293,7 +293,7 @@
int namei(struct nameidata *ndp);
int vfs_lookup(struct nameidata *ndp);
int vfs_relookup(struct vnode *dvp, struct vnode **vpp,
- struct componentname *cnp);
+ struct componentname *cnp, bool refstart);
#endif
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 23, 2:34 PM (17 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32029485
Default Alt Text
D34468.id.diff (3 KB)
Attached To
Mode
D34468: vfs: stop using SAVESTART for rename
Attached
Detach File
Event Timeline
Log In to Comment