1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Handle MAKEENTRY cnp flag in the VOP_CREATE(). Curiously, some

fs, e.g. smbfs, already did it.

Tested by:	pho (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
This commit is contained in:
Konstantin Belousov 2014-12-21 13:29:33 +00:00
parent 0aee91e1fb
commit 789bdfdbc6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=276007
6 changed files with 23 additions and 6 deletions

View File

@ -6180,15 +6180,20 @@ zfs_freebsd_create(ap)
{
struct componentname *cnp = ap->a_cnp;
vattr_t *vap = ap->a_vap;
int mode;
int error, mode;
ASSERT(cnp->cn_flags & SAVENAME);
vattr_init_mask(vap);
mode = vap->va_mode & ALLPERMS;
return (zfs_create(ap->a_dvp, cnp->cn_nameptr, vap, !EXCL, mode,
ap->a_vpp, cnp->cn_cred, cnp->cn_thread));
error = zfs_create(ap->a_dvp, cnp->cn_nameptr, vap, !EXCL, mode,
ap->a_vpp, cnp->cn_cred, cnp->cn_thread);
#ifdef FREEBSD_NAMECACHE
if (error == 0 && (cnp->cn_flags & MAKEENTRY) != 0)
cache_enter(ap->a_dvp, *ap->a_vpp, cnp);
#endif
return (error);
}
static int

View File

@ -239,8 +239,10 @@ ext2_create(struct vop_create_args *ap)
error =
ext2_makeinode(MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode),
ap->a_dvp, ap->a_vpp, ap->a_cnp);
if (error)
if (error != 0)
return (error);
if ((ap->a_cnp->cn_flags & MAKEENTRY) != 0)
cache_enter(ap->a_dvp, *ap->a_vpp, ap->a_cnp);
return (0);
}

View File

@ -184,6 +184,8 @@ msdosfs_create(ap)
if (error)
goto bad;
*ap->a_vpp = DETOV(dep);
if ((cnp->cn_flags & MAKEENTRY) != 0)
cache_enter(ap->a_dvp, *ap->a_vpp, cnp);
return (0);
bad:

View File

@ -1411,6 +1411,8 @@ nandfs_create(struct vop_create_args *ap)
return (error);
}
*vpp = NTOV(node);
if ((cnp->cn_flags & MAKEENTRY) != 0)
cache_enter(dvp, *vpp, cnp);
DPRINTF(VNCALL, ("created file vp %p nandnode %p ino %jx\n", *vpp, node,
(uintmax_t)node->nn_ino));

View File

@ -213,10 +213,14 @@ tmpfs_create(struct vop_create_args *v)
struct vnode **vpp = v->a_vpp;
struct componentname *cnp = v->a_cnp;
struct vattr *vap = v->a_vap;
int error;
MPASS(vap->va_type == VREG || vap->va_type == VSOCK);
return tmpfs_alloc_file(dvp, vpp, vap, cnp, NULL);
error = tmpfs_alloc_file(dvp, vpp, vap, cnp, NULL);
if (error == 0 && (cnp->cn_flags & MAKEENTRY) != 0)
cache_enter(dvp, *vpp, cnp);
return (error);
}
static int

View File

@ -205,8 +205,10 @@ ufs_create(ap)
error =
ufs_makeinode(MAKEIMODE(ap->a_vap->va_type, ap->a_vap->va_mode),
ap->a_dvp, ap->a_vpp, ap->a_cnp);
if (error)
if (error != 0)
return (error);
if ((ap->a_cnp->cn_flags & MAKEENTRY) != 0)
cache_enter(ap->a_dvp, *ap->a_vpp, ap->a_cnp);
return (0);
}