Skip to content

Commit 6958909

Browse files
committed
Resolve cache leak from hard link
Add the 'ihold()' into 'simplefs_link' function The hard link cache and old file cache are both in the cache list, the "kill_block_super" attempts to free the inode cache, it will decrement "i_count" twice. Therefore, if 'i_count' is not 0, 'destroy_inode' will not be called.
1 parent f18a398 commit 6958909

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,7 @@ static int simplefs_link(struct dentry *old_dentry,
897897
brelse(bh);
898898

899899
inode_inc_link_count(inode);
900+
ihold(inode);
900901
d_instantiate(dentry, inode);
901902
return ret;
902903

0 commit comments

Comments
 (0)