v9fs_put_idpool(newfid, &v9ses->fidpool); 
kfree(fcall); } if (wfidno >= 0) { if (!v9fs_t_clunk(v9ses, wfidno, &fcall)) v9fs_put_idpool(wfidno, &v9ses->fidpool); else dprintk(DEBUG_ERROR, "clunk failed: %s\n", FCALL_ERROR(fcall));  
v9fs_create(struct inode *dir,	    struct dentry *file_dentry,	    unsigned int perm, unsigned int open_mode){	struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir);	struct super_block *sb = dir->i_sb;	struct v9fs_fid *dirfid =	    v9fs_fid_lookup(file_dentry->d_parent, FID_WALK);	struct v9fs_fid *fid = NULL;	struct inode *file_inode = NULL;	struct v9fs_fcall *fcall = NULL;	struct v9fs_qid qid;	struct stat newstat;	int dirfidnum = -1;	long newfid = -1;	int result = 0;	unsigned int iounit = 0;	perm = unixmode2p9mode(v9ses, perm);	dprintk(DEBUG_VFS, "dir: %p dentry: %p perm: %o mode: %o\n", dir,		file_dentry, perm, open_mode);	if (!dirfid)		return -EBADF;	dirfidnum = dirfid->fid;	if (dirfidnum < 0) {		dprintk(DEBUG_ERROR, "No fid for the directory #%lu\n",			dir->i_ino);		return -EBADF;	}	if (file_dentry->d_inode) {		dprintk(DEBUG_ERROR,			"Odd. There is an inode for dir %lu, name :%s:\n",			dir->i_ino, file_dentry->d_name.name);		return -EEXIST;	}	newfid = v9fs_get_idpool(&v9ses->fidpool);	if (newfid < 0) {		eprintk(KERN_WARNING, "no free fids available\n");		return -ENOSPC;	}	result = v9fs_t_walk(v9ses, dirfidnum, newfid, NULL, &fcall);	if (result < 0) {		dprintk(DEBUG_ERROR, "clone error: %s\n", FCALL_ERROR(fcall));		v9fs_put_idpool(newfid, &v9ses->fidpool);		newfid = 0;		goto CleanUpFid;	}	kfree(fcall);	result = v9fs_t_create(v9ses, newfid, (char *)file_dentry->d_name.name,			       perm, open_mode, &fcall);	if (result < 0) {		dprintk(DEBUG_ERROR, "create fails: %s(%d)\n",			FCALL_ERROR(fcall), result);		goto CleanUpFid;	}	iounit = fcall->params.rcreate.iounit;	qid = fcall->params.rcreate.qid;	kfree(fcall);	fid = v9fs_fid_create(file_dentry);	if (!fid) {		result = -ENOMEM;		goto CleanUpFid;	}	fid->fid = newfid;	fid->fidopen = 0;	fid->fidcreate = 1;	fid->qid = qid;	fid->iounit = iounit;	fid->rdir_pos = 0;	fid->rdir_fcall = NULL;	fid->v9ses = v9ses;	if ((perm & V9FS_DMSYMLINK) || (perm & V9FS_DMLINK) ||	    (perm & V9FS_DMNAMEDPIPE) || (perm & V9FS_DMSOCKET) ||	    (perm & V9FS_DMDEVICE))		return 0;	result = v9fs_t_stat(v9ses, newfid, &fcall);	if (result < 0) {		dprintk(DEBUG_ERROR, "stat error: %s(%d)\n", FCALL_ERROR(fcall),			result);		goto CleanUpFid;	}	v9fs_mistat2unix(fcall->params.rstat.stat, &newstat, sb);	file_inode = v9fs_get_inode(sb, newstat.st_mode);	if ((!file_inode) || IS_ERR(file_inode)) {		dprintk(DEBUG_ERROR, "create inode failed\n");		result = -EBADF;		goto CleanUpFid;	}	v9fs_mistat2inode(fcall->params.rstat.stat, file_inode, sb);	kfree(fcall);	d_instantiate(file_dentry, file_inode);	if (perm & V9FS_DMDIR) {		if (v9fs_t_clunk(v9ses, newfid, &fcall))			dprintk(DEBUG_ERROR, "clunk for mkdir failed: %s\n",				FCALL_ERROR(fcall));		v9fs_put_idpool(newfid, &v9ses->fidpool);		kfree(fcall);		fid->fidopen = 0;		fid->fidcreate = 0;		d_drop(file_dentry);	}	return 0;      CleanUpFid:	kfree(fcall);	if (newfid) {		if (v9fs_t_clunk(v9ses, newfid, &fcall))			dprintk(DEBUG_ERROR, "clunk failed: %s\n",				FCALL_ERROR(fcall));		v9fs_put_idpool(newfid, &v9ses->fidpool);		kfree(fcall);	}	return result;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/0b8dd17762194ec77066d339e0b2866b0c66b715/vfs_inode.c/buggy/fs/9p/vfs_inode.c