/* Be careful about ever adding any more callers of this function. Its flags must be in the namei format, not what get passed to sys_open().  */
static int __open_namei_create(struct nameidata *nd, struct path *path, int flag, int mode)
/* Be careful about ever adding any more callers of this function. Its flags must be in the namei format, not what get passed to sys_open().  */
static int __open_namei_create(struct nameidata *nd, struct path *path, int flag, int mode)
{
	int error;
	struct dentry *dir = nd->path.dentry;
	if (!IS_POSIXACL(dir->d_inode))
		mode &= ~current_umask();
	error = security_path_mknod(&nd->path, path->dentry, mode, 0);
	if (error)
		goto out_unlock;
	error = vfs_create(dir->d_inode, path->dentry, mode, nd);
out_unlock:
	mutex_unlock(&dir->d_inode->i_mutex);
	dput(nd->path.dentry);
	nd->path.dentry = path->dentry;
	if (error)
		return error;
	return may_open(&nd->path, 0, flag & ~O_TRUNC);
}