linux likes to kill bad inodes
Quoted 2 lines · I previously
I will post a patch separately which handles a couple of cases where
*_delete_inode()does not callclear_inode()in all cases.
OK, here it is. The ext2_delete_inode() change isn't exactly a bug fix, but rather a "performance" change. No need to hold BLK to check status or call clear_inode() (we call clear_inode() outside BLK in VFS if delete_inode() method does not exist).
Cheers, Andreas
=======================================================================
fs/ext2/inode.c +2 -3
@@ -44,12 +47,12 @@*/ void ext2_delete_inode (struct inode * inode) { -lock_kernel (); -if (is_bad_inode (inode) || inode->i_ino ==EXT2_ACL_IDX_INO || inode->i_ino ==EXT2_ACL_DATA_INO ) goto no_delete; + +lock_kernel (); inode->u.ext2_i.i_dtime =CURRENT_TIME ;mark_inode_dirty (inode);ext2_update_inode (inode,IS_SYNC (inode));
@@ -59,9 +62,7 @@ext2_free_inode (inode);unlock_kernel ();return ; no_delete: -unlock_kernel ();clear_inode (inode);/* We must guarantee clearing of inode... */ }
fs/bfs/inode.c +4 -3
@@ -145,7 +145,7 @@if (is_bad_inode (inode) || inode->i_ino <BFS_ROOT_INO || inode->i_ino > inode->i_sb->su_lasti) {printf ("invalid ino=%08lx\n" , inode->i_ino); -return ; + goto bad_inode; } inode->i_size =0 ;
@@ -155,8 +156,7 @@ bh =bread (dev, block,BFS_BSIZE );if (!bh) {printf ("Unable to read inode %s:%08lx\n" ,bdevname (dev), ino); -unlock_kernel (); -return ; + goto bad_unlock; } off = (ino -BFS_ROOT_INO )%BFS_INODES_PER_BLOCK ; di = (struct bfs_inode *)bh->b_data + off;
@@ -178,7 +178,9 @@ s->su_lf_eblk = inode->iu_sblock -1 ;mark_buffer_dirty (s->su_sbh); } +bad_unlock:unlock_kernel (); +bad_inode:clear_inode (inode); }
fs/ufs/ialloc.c +2 -0
@@ -82,6 +82,7 @@if (!((ino >1 ) && (ino < (uspi->s_ncg * uspi->s_ipg )))) {ufs_warning (sb,"ufs_free_inode" ,"reserved inode or nonexistent inode %u\n" , ino);unlock_super (sb); +clear_inode (inode);return ; }
@@ -90,6 +91,7 @@ ucpi =ufs_load_cylinder (sb, cg);if (!ucpi) {unlock_super (sb); +clear_inode (inode);return ; } ucg =ubh_get_ucg (UCPI_UBH );
Signature · 3 lines
Andreas Dilger TurboLabs filesystem development http://sourceforge.net/projects/ext2resize/ http://www-mddsp.enel.ucalgary.ca/People/adilger/