fix error handling in xlog_recover_process_one_iunlink
If we fail after xfs_iget we have to drop the reference count, spotted by Dave Chinner. Also remove some useless asserts and stop trying to deal with di_mode == 0 inodes because never gets those without passing the IGET_CREATE flag to xfs_iget.
fs/xfs/xfs_log_recover.c +5 -13
@@ -3147,13 +3147,12 @@ xlog_recover_process_one_iunlink(/* * Get the on disk inode to find the next inode in the bucket. */ -ASSERT (ip !=NULL ); error =xfs_itobp (mp,NULL , ip, &dip, &ibp,XFS_BUF_LOCK );if (error) - goto fail; + goto fail_iput; -ASSERT (dip !=NULL );ASSERT (ip->i_d.di_nlink ==0 ); +ASSERT (ip->i_d.di_mode !=0 );/* setup for the next pass */ agino =be32_to_cpu (dip->di_next_unlinked);
@@ -3165,18 +3164,11 @@ xlog_recover_process_one_iunlink(*/ ip->i_d.di_dmevmask =0 ; -/* -* If this is a new inode, handle it specially. Otherwise, just -* drop our reference to the inode. If there are no other -* references, this will send the inode to xfs_inactive() which -* will truncate the file and free the inode. -*/ -if (ip->i_d.di_mode ==0 ) -xfs_iput_new (ip,0 ); -else -IRELE (ip); +IRELE (ip);return agino; + fail_iput: +IRELE (ip); fail:/* * We can't read in the inode this bucket points to, or this inode
Quoted 7 lines · Christoph Hellwig
If we fail after
xfs_igetwe have to drop the reference count, spotted by Dave Chinner. Also remove some useless asserts and stop trying to deal withdi_mode== 0 inodes because never gets those without passing theIGET_CREATEflag toxfs_iget.Signed-off-by Christoph Hellwig <[email protected]>
Seems fine to me.
-Eric
Quoted 34 lines
Index:
linux-2.6-xfs/fs/xfs/xfs_log_recover.c
===================================================================fs/xfs/xfs_log_recover.c +2
-11@@ -3147,13 +3147,12 @@ xlog_recover_process_one_iunlink(/* * Get the on disk inode to find the next inode in the bucket. */ -ASSERT (ip !=NULL ); error =xfs_itobp (mp,NULL , ip, &dip, &ibp,XFS_BUF_LOCK );if (error) - goto fail; + goto fail_iput; -ASSERT (dip !=NULL );ASSERT (ip->i_d.di_nlink ==0 ); +ASSERT (ip->i_d.di_mode !=0 );/* setup for the next pass */ agino =be32_to_cpu (dip->di_next_unlinked);@@ -3165,18 +3164,11 @@ xlog_recover_process_one_iunlink(*/ ip->i_d.di_dmevmask =0 ; -/* -* If this is a new inode, handle it specially. Otherwise, just -* drop our reference to the inode. If there are no other -* references, this will send the inode to xfs_inactive() which -* will truncate the file and free the inode. -*/ -if (ip->i_d.di_mode ==0 ) -xfs_iput_new (ip,0 );
fs/xfs/xfs_log_recover.c xlog_recover_process_one_iunlink( · line 3174
Quoted 10 lines
fs/xfs/xfs_log_recover.c +3
-2-else -IRELE (ip); +IRELE (ip);return agino; + fail_iput: +IRELE (ip); fail:/* * We can't read in the inode this bucket points to, or this inode
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs