diff options
Diffstat (limited to 'fs/ext2/inode.c')
-rw-r--r-- | fs/ext2/inode.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index b890be02249..a50d9db4b6e 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -53,6 +53,19 @@ static inline int ext2_inode_is_fast_symlink(struct inode *inode) } /* + * Called at each iput(). + * + * The inode may be "bad" if ext2_read_inode() saw an error from + * ext2_get_inode(), so we need to check that to avoid freeing random disk + * blocks. + */ +void ext2_put_inode(struct inode *inode) +{ + if (!is_bad_inode(inode)) + ext2_discard_prealloc(inode); +} + +/* * Called at the last iput() if i_nlink is zero. */ void ext2_delete_inode (struct inode * inode) |