diff --git a/lustre/smfs/inode.c b/lustre/smfs/inode.c index 1c7576fd1781c8ee2a889e53568d0eafd87db57d..b88139765cbaea3c0256d126ca778b7ba5aef331 100644 --- a/lustre/smfs/inode.c +++ b/lustre/smfs/inode.c @@ -64,10 +64,11 @@ static void smfs_init_inode_info (struct inode *inode, void *opaque) static void smfs_clear_inode_info(struct inode *inode) { struct inode *cache_inode = I2CI(inode); - + LASSERTF(atomic_read(&cache_inode->i_count) == 1, - "cache inode %lu i_count %d not 0\n", cache_inode->i_ino, + "inode %lu i_count %d != 1\n", cache_inode->i_ino, atomic_read(&cache_inode->i_count)); + iput(cache_inode); OBD_FREE(I2SMI(inode), sizeof(struct smfs_inode_info)); } @@ -268,8 +269,8 @@ static void smfs_put_inode(struct inode *inode) CDEBUG(D_INFO, "cache_inode i_count ino %lu i_count %d\n", inode->i_ino, atomic_read(&inode->i_count)); - if (atomic_read(&cache_inode->i_count) > 1 && - cache_inode != cache_inode->i_sb->s_root->d_inode) { + if (atomic_read(&cache_inode->i_count) > 1 /*&& + cache_inode != cache_inode->i_sb->s_root->d_inode*/) { CDEBUG(D_INFO, "cache_inode i_count ino %lu i_count %d\n", cache_inode->i_ino, atomic_read(&cache_inode->i_count) - 1); @@ -306,8 +307,8 @@ static void smfs_clear_inode(struct inode *inode) cache_inode = I2CI(inode); - if (cache_inode != cache_inode->i_sb->s_root->d_inode) - smfs_clear_inode_info(inode); + smfs_clear_inode_info(inode); + EXIT; return; } diff --git a/lustre/smfs/smfs_internal.h b/lustre/smfs/smfs_internal.h index be44d54906e18604dfea9fa878820e9a608d90f7..ebca06e5d1879f6d220e542dfe38c3345ec34b30 100644 --- a/lustre/smfs/smfs_internal.h +++ b/lustre/smfs/smfs_internal.h @@ -131,6 +131,8 @@ struct smfs_hook_ops *smfs_unregister_hook_ops(struct smfs_super_info *smb, /*smfs_lib.c*/ void smfs_put_super(struct super_block *sb); int smfs_fill_super(struct super_block *sb, void *data, int silent); + +void smfs_cleanup_hooks(struct smfs_super_info *smb); /*sysctl.c*/ extern int sm_debug_level; extern int sm_inodes; diff --git a/lustre/smfs/smfs_lib.c b/lustre/smfs/smfs_lib.c index 05d172c5f464e8de5d860d94e46048dfa58e12b4..33b017a82c38d322a28dbd8ffcb99a505a52ca77 100644 --- a/lustre/smfs/smfs_lib.c +++ b/lustre/smfs/smfs_lib.c @@ -163,8 +163,6 @@ err_out: static int smfs_umount_cache(struct smfs_super_info *smb) { - iput(smb->smsi_sb->s_root->d_inode); - dput(smb->smsi_sb->s_root); mntput(smb->smsi_mnt); smfs_cleanup_sm_ops(smb); smfs_cleanup_fsfilt_ops(smb); @@ -216,7 +214,7 @@ static void smfs_cleanup_smb(struct super_block *sb) EXIT; return; } -static void smfs_cleanup_hooks(struct smfs_super_info *smb) +void smfs_cleanup_hooks(struct smfs_super_info *smb) { if (SMFS_CACHE_HOOK(smb)) @@ -227,15 +225,16 @@ static void smfs_cleanup_hooks(struct smfs_super_info *smb) if (SMFS_DO_COW(smb)) smfs_cow_cleanup(smb); #endif + smfs_cleanup_hook_ops(smb); } void smfs_put_super(struct super_block *sb) { struct smfs_super_info *smfs_info = S2SMI(sb); +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) smfs_cleanup_hooks(smfs_info); - - smfs_cleanup_hook_ops(smfs_info); +#endif if (sb) smfs_umount_cache(smfs_info); smfs_cleanup_smb(sb); diff --git a/lustre/smfs/super.c b/lustre/smfs/super.c index 1056bfcba7d5ca3c93f9c6fac8b5ef2bf0d74b9c..dd92c0b74e82b7fed6df6ef519e2d83b951ef091 100644 --- a/lustre/smfs/super.c +++ b/lustre/smfs/super.c @@ -69,12 +69,16 @@ struct super_block *smfs_get_sb(struct file_system_type *fs_type, int flags, { return get_sb_nodev(fs_type, flags, data, smfs_fill_super); } - +void smfs_kill_super(struct super_block *sb) +{ + smfs_cleanup_hooks(S2SMI(sb)); + kill_anon_super(sb); +} static struct file_system_type smfs_type = { .owner = THIS_MODULE, .name = "smfs", .get_sb = smfs_get_sb, - .kill_sb = kill_anon_super, + .kill_sb = smfs_kill_super, }; #endif