if (sbi->s_qf_names[j]) kfree(sbi->s_qf_names[j]); 
kfree(sbi->s_qf_names[j]); sbi->s_qf_names[j] = NULL; 
static int reiserfs_fill_super(struct super_block *s, void *data, int silent){	struct inode *root_inode;	int j;	struct reiserfs_transaction_handle th;	int old_format = 0;	unsigned long blocks;	unsigned int commit_max_age = 0;	int jinit_done = 0;	struct reiserfs_iget_args args;	struct reiserfs_super_block *rs;	char *jdev_name;	struct reiserfs_sb_info *sbi;	int errval = -EINVAL;	sbi = kmalloc(sizeof(struct reiserfs_sb_info), GFP_KERNEL);	if (!sbi) {		errval = -ENOMEM;		goto error;	}	s->s_fs_info = sbi;	memset(sbi, 0, sizeof(struct reiserfs_sb_info));	/* Set default values for options: non-aggressive tails, RO on errors */	REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_SMALLTAIL);	REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_ERROR_RO);	/* no preallocation minimum, be smart in	   reiserfs_file_write instead */	REISERFS_SB(s)->s_alloc_options.preallocmin = 0;	/* Preallocate by 16 blocks (17-1) at once */	REISERFS_SB(s)->s_alloc_options.preallocsize = 17;	/* Initialize the rwsem for xattr dir */	init_rwsem(&REISERFS_SB(s)->xattr_dir_sem);	/* setup default block allocator options */	reiserfs_init_alloc_options(s);	jdev_name = NULL;	if (reiserfs_parse_options	    (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name,	     &commit_max_age) == 0) {		goto error;	}	if (blocks) {		SWARN(silent, s, "jmacd-7: reiserfs_fill_super: resize option "		      "for remount only");		goto error;	}	/* try old format (undistributed bitmap, super block in 8-th 1k block of a device) */	if (!read_super_block(s, REISERFS_OLD_DISK_OFFSET_IN_BYTES))		old_format = 1;	/* try new format (64-th 1k block), which can contain reiserfs super block */	else if (read_super_block(s, REISERFS_DISK_OFFSET_IN_BYTES)) {		SWARN(silent, s,		      "sh-2021: reiserfs_fill_super: can not find reiserfs on %s",		      reiserfs_bdevname(s));		goto error;	}	rs = SB_DISK_SUPER_BLOCK(s);	/* Let's do basic sanity check to verify that underlying device is not	   smaller than the filesystem. If the check fails then abort and scream,	   because bad stuff will happen otherwise. */	if (s->s_bdev && s->s_bdev->bd_inode	    && i_size_read(s->s_bdev->bd_inode) <	    sb_block_count(rs) * sb_blocksize(rs)) {		SWARN(silent, s,		      "Filesystem on %s cannot be mounted because it is bigger than the device",		      reiserfs_bdevname(s));		SWARN(silent, s,		      "You may need to run fsck or increase size of your LVM partition");		SWARN(silent, s,		      "Or may be you forgot to reboot after fdisk when it told you to");		goto error;	}	sbi->s_mount_state = SB_REISERFS_STATE(s);	sbi->s_mount_state = REISERFS_VALID_FS;	if (old_format ? read_old_bitmaps(s) : read_bitmaps(s)) {		SWARN(silent, s,		      "jmacd-8: reiserfs_fill_super: unable to read bitmap");		goto error;	}#ifdef CONFIG_REISERFS_CHECK	SWARN(silent, s, "CONFIG_REISERFS_CHECK is set ON");	SWARN(silent, s, "- it is slow mode for debugging.");#endif	/* make data=ordered the default */	if (!reiserfs_data_log(s) && !reiserfs_data_ordered(s) &&	    !reiserfs_data_writeback(s)) {		REISERFS_SB(s)->s_mount_opt |= (1 << REISERFS_DATA_ORDERED);	}	if (reiserfs_data_log(s)) {		reiserfs_info(s, "using journaled data mode\n");	} else if (reiserfs_data_ordered(s)) {		reiserfs_info(s, "using ordered data mode\n");	} else {		reiserfs_info(s, "using writeback data mode\n");	}	if (reiserfs_barrier_flush(s)) {		printk("reiserfs: using flush barriers\n");	}	// set_device_ro(s->s_dev, 1) ;	if (journal_init(s, jdev_name, old_format, commit_max_age)) {		SWARN(silent, s,		      "sh-2022: reiserfs_fill_super: unable to initialize journal space");		goto error;	} else {		jinit_done = 1;	/* once this is set, journal_release must be called				 ** if we error out of the mount				 */	}	if (reread_meta_blocks(s)) {		SWARN(silent, s,		      "jmacd-9: reiserfs_fill_super: unable to reread meta blocks after journal init");		goto error;	}	if (replay_only(s))		goto error;	if (bdev_read_only(s->s_bdev) && !(s->s_flags & MS_RDONLY)) {		SWARN(silent, s,		      "clm-7000: Detected readonly device, marking FS readonly");		s->s_flags |= MS_RDONLY;	}	args.objectid = REISERFS_ROOT_OBJECTID;	args.dirid = REISERFS_ROOT_PARENT_OBJECTID;	root_inode =	    iget5_locked(s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor,			 reiserfs_init_locked_inode, (void *)(&args));	if (!root_inode) {		SWARN(silent, s,		      "jmacd-10: reiserfs_fill_super: get root inode failed");		goto error;	}	if (root_inode->i_state & I_NEW) {		reiserfs_read_locked_inode(root_inode, &args);		unlock_new_inode(root_inode);	}	s->s_root = d_alloc_root(root_inode);	if (!s->s_root) {		iput(root_inode);		goto error;	}	// define and initialize hash function	sbi->s_hash_function = hash_function(s);	if (sbi->s_hash_function == NULL) {		dput(s->s_root);		s->s_root = NULL;		goto error;	}	if (is_reiserfs_3_5(rs)	    || (is_reiserfs_jr(rs) && SB_VERSION(s) == REISERFS_VERSION_1))		set_bit(REISERFS_3_5, &(sbi->s_properties));	else		set_bit(REISERFS_3_6, &(sbi->s_properties));	if (!(s->s_flags & MS_RDONLY)) {		errval = journal_begin(&th, s, 1);		if (errval) {			dput(s->s_root);			s->s_root = NULL;			goto error;		}		reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);		set_sb_umount_state(rs, REISERFS_ERROR_FS);		set_sb_fs_state(rs, 0);		if (old_format_only(s)) {			/* filesystem of format 3.5 either with standard or non-standard			   journal */			if (convert_reiserfs(s)) {				/* and -o conv is given */				if (!silent)					reiserfs_info(s,						      "converting 3.5 filesystem to the 3.6 format");				if (is_reiserfs_3_5(rs))					/* put magic string of 3.6 format. 2.2 will not be able to					   mount this filesystem anymore */					memcpy(rs->s_v1.s_magic,					       reiserfs_3_6_magic_string,					       sizeof					       (reiserfs_3_6_magic_string));				set_sb_version(rs, REISERFS_VERSION_2);				reiserfs_convert_objectid_map_v1(s);				set_bit(REISERFS_3_6, &(sbi->s_properties));				clear_bit(REISERFS_3_5, &(sbi->s_properties));			} else if (!silent) {				reiserfs_info(s, "using 3.5.x disk format\n");			}		}		journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));		errval = journal_end(&th, s, 1);		if (errval) {			dput(s->s_root);			s->s_root = NULL;			goto error;		}		if ((errval = reiserfs_xattr_init(s, s->s_flags))) {			dput(s->s_root);			s->s_root = NULL;			goto error;		}		/* look for files which were to be removed in previous session */		finish_unfinished(s);	} else {		if (old_format_only(s) && !silent) {			reiserfs_info(s, "using 3.5.x disk format\n");		}		if ((errval = reiserfs_xattr_init(s, s->s_flags))) {			dput(s->s_root);			s->s_root = NULL;			goto error;		}	}	// mark hash in super block: it could be unset. overwrite should be ok	set_sb_hash_function_code(rs, function2code(sbi->s_hash_function));	handle_attrs(s);	reiserfs_proc_info_init(s);	init_waitqueue_head(&(sbi->s_wait));	spin_lock_init(&sbi->bitmap_lock);	return (0);      error:	if (jinit_done) {	/* kill the commit thread, free journal ram */		journal_release_error(NULL, s);	}	if (SB_DISK_SUPER_BLOCK(s)) {		for (j = 0; j < SB_BMAP_NR(s); j++) {			if (SB_AP_BITMAP(s))				brelse(SB_AP_BITMAP(s)[j].bh);		}		vfree(SB_AP_BITMAP(s));	}	if (SB_BUFFER_WITH_SB(s))		brelse(SB_BUFFER_WITH_SB(s));#ifdef CONFIG_QUOTA	for (j = 0; j < MAXQUOTAS; j++) {		if (sbi->s_qf_names[j])			kfree(sbi->s_qf_names[j]);	}#endif	if (sbi != NULL) {		kfree(sbi);	}	s->s_fs_info = NULL;	return errval;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/833d304b22edff5cc687ab7e5549c2f0dcdd951a/super.c/buggy/fs/reiserfs/super.c