Skip to content

Commit

Permalink
Fix Symbolic link remove problem
Browse files Browse the repository at this point in the history
    When we create symbolic link, in simplefs_new_inode function, the symbolic
does not use ei_block to record the using block. But in simplefs_unlink function
we use the ei_block to clean the bitmap, this makes the unlink will clean the "0"
bit in bitmap.

Close #58
  • Loading branch information
RoyWFHuang committed Aug 18, 2024
1 parent 56d2ca0 commit 4086eec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,8 @@ static int simplefs_unlink(struct inode *dir, struct dentry *dentry)
mark_inode_dirty(inode);

/* Free inode and index block from bitmap */
put_blocks(sbi, bno, 1);
if (S_ISLNK(inode->i_mode))
put_blocks(sbi, bno, 1);
put_inode(sbi, ino);

return ret;
Expand Down

0 comments on commit 4086eec

Please sign in to comment.