summaryrefslogtreecommitdiffstats
path: root/sys/fs/tmpfs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-07-28 01:16:07 +0000
committerkib <kib@FreeBSD.org>2014-07-28 01:16:07 +0000
commitd2764792a74c6d5fbdff0f50856cc3130afc40da (patch)
tree393f58579a70afd653a47ac264cd3fe212809f8d /sys/fs/tmpfs
parent86ba2f30ead3fa16f0841b27e8fa7cffecbc8e5a (diff)
downloadFreeBSD-src-d2764792a74c6d5fbdff0f50856cc3130afc40da.zip
FreeBSD-src-d2764792a74c6d5fbdff0f50856cc3130afc40da.tar.gz
MFC r268614:
Use tmpfs_vn_get_ino_gen() to handle the races with reclaim in tmpfs dotdot lookup.
Diffstat (limited to 'sys/fs/tmpfs')
-rw-r--r--sys/fs/tmpfs/tmpfs_vnops.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index a92c75d..cb35a69 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -69,15 +69,22 @@ SYSCTL_INT(_vfs_tmpfs, OID_AUTO, rename_restarts, CTLFLAG_RD,
"Times rename had to restart due to lock contention");
static int
+tmpfs_vn_get_ino_alloc(struct mount *mp, void *arg, int lkflags,
+ struct vnode **rvp)
+{
+
+ return (tmpfs_alloc_vp(mp, arg, lkflags, rvp));
+}
+
+static int
tmpfs_lookup(struct vop_cachedlookup_args *v)
{
struct vnode *dvp = v->a_dvp;
struct vnode **vpp = v->a_vpp;
struct componentname *cnp = v->a_cnp;
-
- int error;
struct tmpfs_dirent *de;
struct tmpfs_node *dnode;
+ int error;
dnode = VP_TO_TMPFS_DIR(dvp);
*vpp = NULLVP;
@@ -98,17 +105,10 @@ tmpfs_lookup(struct vop_cachedlookup_args *v)
goto out;
}
if (cnp->cn_flags & ISDOTDOT) {
- int ltype = 0;
-
- ltype = VOP_ISLOCKED(dvp);
- vhold(dvp);
- VOP_UNLOCK(dvp, 0);
- /* Allocate a new vnode on the matching entry. */
- error = tmpfs_alloc_vp(dvp->v_mount, dnode->tn_dir.tn_parent,
- cnp->cn_lkflags, vpp);
-
- vn_lock(dvp, ltype | LK_RETRY);
- vdrop(dvp);
+ error = vn_vget_ino_gen(dvp, tmpfs_vn_get_ino_alloc,
+ dnode->tn_dir.tn_parent, cnp->cn_lkflags, vpp);
+ if (error != 0)
+ goto out;
} else if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') {
VREF(dvp);
*vpp = dvp;
OpenPOWER on IntegriCloud