diff options
-rw-r--r-- | fs/inode.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/inode.c b/fs/inode.c index 71df1b1e8f75..f80a79ff156b 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -1034,19 +1034,21 @@ void generic_delete_inode(struct inode *inode) | |||
1034 | inodes_stat.nr_inodes--; | 1034 | inodes_stat.nr_inodes--; |
1035 | spin_unlock(&inode_lock); | 1035 | spin_unlock(&inode_lock); |
1036 | 1036 | ||
1037 | if (inode->i_data.nrpages) | ||
1038 | truncate_inode_pages(&inode->i_data, 0); | ||
1039 | |||
1040 | security_inode_delete(inode); | 1037 | security_inode_delete(inode); |
1041 | 1038 | ||
1042 | if (op->delete_inode) { | 1039 | if (op->delete_inode) { |
1043 | void (*delete)(struct inode *) = op->delete_inode; | 1040 | void (*delete)(struct inode *) = op->delete_inode; |
1044 | if (!is_bad_inode(inode)) | 1041 | if (!is_bad_inode(inode)) |
1045 | DQUOT_INIT(inode); | 1042 | DQUOT_INIT(inode); |
1046 | /* s_op->delete_inode internally recalls clear_inode() */ | 1043 | /* Filesystems implementing their own |
1044 | * s_op->delete_inode are required to call | ||
1045 | * truncate_inode_pages and clear_inode() | ||
1046 | * internally */ | ||
1047 | delete(inode); | 1047 | delete(inode); |
1048 | } else | 1048 | } else { |
1049 | truncate_inode_pages(&inode->i_data, 0); | ||
1049 | clear_inode(inode); | 1050 | clear_inode(inode); |
1051 | } | ||
1050 | spin_lock(&inode_lock); | 1052 | spin_lock(&inode_lock); |
1051 | hlist_del_init(&inode->i_hash); | 1053 | hlist_del_init(&inode->i_hash); |
1052 | spin_unlock(&inode_lock); | 1054 | spin_unlock(&inode_lock); |