if (REISERFS_I(dir)->i_acl_default) { 
if (REISERFS_I(dir)->i_acl_default && !IS_ERR(REISERFS_I(dir)->i_acl_default)) { 
int reiserfs_new_inode(struct reiserfs_transaction_handle *th,		       struct inode *dir, int mode, const char *symname,		       /* 0 for regular, EMTRY_DIR_SIZE for dirs, 		          strlen (symname) for symlinks) */		       loff_t i_size, struct dentry *dentry,		       struct inode *inode){	struct super_block *sb;	INITIALIZE_PATH(path_to_key);	struct cpu_key key;	struct item_head ih;	struct stat_data sd;	int retval;	int err;	BUG_ON(!th->t_trans_id);	if (DQUOT_ALLOC_INODE(inode)) {		err = -EDQUOT;		goto out_end_trans;	}	if (!dir || !dir->i_nlink) {		err = -EPERM;		goto out_bad_inode;	}	sb = dir->i_sb;	/* item head of new item */	ih.ih_key.k_dir_id = reiserfs_choose_packing(dir);	ih.ih_key.k_objectid = cpu_to_le32(reiserfs_get_unused_objectid(th));	if (!ih.ih_key.k_objectid) {		err = -ENOMEM;		goto out_bad_inode;	}	if (old_format_only(sb))		/* not a perfect generation count, as object ids can be reused, but 		 ** this is as good as reiserfs can do right now.		 ** note that the private part of inode isn't filled in yet, we have		 ** to use the directory.		 */		inode->i_generation = le32_to_cpu(INODE_PKEY(dir)->k_objectid);	else#if defined( USE_INODE_GENERATION_COUNTER )		inode->i_generation =		    le32_to_cpu(REISERFS_SB(sb)->s_rs->s_inode_generation);#else		inode->i_generation = ++event;#endif	/* fill stat data */	inode->i_nlink = (S_ISDIR(mode) ? 2 : 1);	/* uid and gid must already be set by the caller for quota init */	/* symlink cannot be immutable or append only, right? */	if (S_ISLNK(inode->i_mode))		inode->i_flags &= ~(S_IMMUTABLE | S_APPEND);	inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;	inode->i_size = i_size;	inode->i_blocks = 0;	inode->i_bytes = 0;	REISERFS_I(inode)->i_first_direct_byte = S_ISLNK(mode) ? 1 :	    U32_MAX /*NO_BYTES_IN_DIRECT_ITEM */ ;	INIT_LIST_HEAD(&(REISERFS_I(inode)->i_prealloc_list));	REISERFS_I(inode)->i_flags = 0;	REISERFS_I(inode)->i_prealloc_block = 0;	REISERFS_I(inode)->i_prealloc_count = 0;	REISERFS_I(inode)->i_trans_id = 0;	REISERFS_I(inode)->i_jl = NULL;	REISERFS_I(inode)->i_attrs =	    REISERFS_I(dir)->i_attrs & REISERFS_INHERIT_MASK;	sd_attrs_to_i_attrs(REISERFS_I(inode)->i_attrs, inode);	REISERFS_I(inode)->i_acl_access = NULL;	REISERFS_I(inode)->i_acl_default = NULL;	init_rwsem(&REISERFS_I(inode)->xattr_sem);	if (old_format_only(sb))		make_le_item_head(&ih, NULL, KEY_FORMAT_3_5, SD_OFFSET,				  TYPE_STAT_DATA, SD_V1_SIZE, MAX_US_INT);	else		make_le_item_head(&ih, NULL, KEY_FORMAT_3_6, SD_OFFSET,				  TYPE_STAT_DATA, SD_SIZE, MAX_US_INT);	/* key to search for correct place for new stat data */	_make_cpu_key(&key, KEY_FORMAT_3_6, le32_to_cpu(ih.ih_key.k_dir_id),		      le32_to_cpu(ih.ih_key.k_objectid), SD_OFFSET,		      TYPE_STAT_DATA, 3 /*key length */ );	/* find proper place for inserting of stat data */	retval = search_item(sb, &key, &path_to_key);	if (retval == IO_ERROR) {		err = -EIO;		goto out_bad_inode;	}	if (retval == ITEM_FOUND) {		pathrelse(&path_to_key);		err = -EEXIST;		goto out_bad_inode;	}	if (old_format_only(sb)) {		if (inode->i_uid & ~0xffff || inode->i_gid & ~0xffff) {			pathrelse(&path_to_key);			/* i_uid or i_gid is too big to be stored in stat data v3.5 */			err = -EINVAL;			goto out_bad_inode;		}		inode2sd_v1(&sd, inode, inode->i_size);	} else {		inode2sd(&sd, inode, inode->i_size);	}	// these do not go to on-disk stat data	inode->i_ino = le32_to_cpu(ih.ih_key.k_objectid);	inode->i_blksize = reiserfs_default_io_size;	// store in in-core inode the key of stat data and version all	// object items will have (directory items will have old offset	// format, other new objects will consist of new items)	memcpy(INODE_PKEY(inode), &(ih.ih_key), KEY_SIZE);	if (old_format_only(sb) || S_ISDIR(mode) || S_ISLNK(mode))		set_inode_item_key_version(inode, KEY_FORMAT_3_5);	else		set_inode_item_key_version(inode, KEY_FORMAT_3_6);	if (old_format_only(sb))		set_inode_sd_version(inode, STAT_DATA_V1);	else		set_inode_sd_version(inode, STAT_DATA_V2);	/* insert the stat data into the tree */#ifdef DISPLACE_NEW_PACKING_LOCALITIES	if (REISERFS_I(dir)->new_packing_locality)		th->displace_new_blocks = 1;#endif	retval =	    reiserfs_insert_item(th, &path_to_key, &key, &ih, inode,				 (char *)(&sd));	if (retval) {		err = retval;		reiserfs_check_path(&path_to_key);		goto out_bad_inode;	}#ifdef DISPLACE_NEW_PACKING_LOCALITIES	if (!th->displace_new_blocks)		REISERFS_I(dir)->new_packing_locality = 0;#endif	if (S_ISDIR(mode)) {		/* insert item with "." and ".." */		retval =		    reiserfs_new_directory(th, inode, &ih, &path_to_key, dir);	}	if (S_ISLNK(mode)) {		/* insert body of symlink */		if (!old_format_only(sb))			i_size = ROUND_UP(i_size);		retval =		    reiserfs_new_symlink(th, inode, &ih, &path_to_key, symname,					 i_size);	}	if (retval) {		err = retval;		reiserfs_check_path(&path_to_key);		journal_end(th, th->t_super, th->t_blocks_allocated);		goto out_inserted_sd;	}	/* XXX CHECK THIS */	if (reiserfs_posixacl(inode->i_sb)) {		retval = reiserfs_inherit_default_acl(dir, dentry, inode);		if (retval) {			err = retval;			reiserfs_check_path(&path_to_key);			journal_end(th, th->t_super, th->t_blocks_allocated);			goto out_inserted_sd;		}	} else if (inode->i_sb->s_flags & MS_POSIXACL) {		reiserfs_warning(inode->i_sb, "ACLs aren't enabled in the fs, "				 "but vfs thinks they are!");	} else if (is_reiserfs_priv_object(dir)) {		reiserfs_mark_inode_private(inode);	}	insert_inode_hash(inode);	reiserfs_update_sd(th, inode);	reiserfs_check_path(&path_to_key);	return 0;/* it looks like you can easily compress these two goto targets into * one.  Keeping it like this doesn't actually hurt anything, and they * are place holders for what the quota code actually needs. */      out_bad_inode:	/* Invalidate the object, nothing was inserted yet */	INODE_PKEY(inode)->k_objectid = 0;	/* Quota change must be inside a transaction for journaling */	DQUOT_FREE_INODE(inode);      out_end_trans:	journal_end(th, th->t_super, th->t_blocks_allocated);	/* Drop can be outside and it needs more credits so it's better to have it outside */	DQUOT_DROP(inode);	inode->i_flags |= S_NOQUOTA;	make_bad_inode(inode);      out_inserted_sd:	inode->i_nlink = 0;	th->t_trans_id = 0;	/* so the caller can't use this handle later */	/* If we were inheriting an ACL, we need to release the lock so that	 * iput doesn't deadlock in reiserfs_delete_xattrs. The locking	 * code really needs to be reworked, but this will take care of it	 * for now. -jeffm */	if (REISERFS_I(dir)->i_acl_default) {		reiserfs_write_unlock_xattrs(dir->i_sb);		iput(inode);		reiserfs_write_lock_xattrs(dir->i_sb);	} else		iput(inode);	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/d86c390ffbf5746df9a3cc2c5f7b75d27704580f/inode.c/buggy/fs/reiserfs/inode.c