From 4086eecd420cc459ff64c793ef9b420889f25554 Mon Sep 17 00:00:00 2001 From: roy Date: Sun, 18 Aug 2024 16:42:26 +0800 Subject: [PATCH] Fix Symbolic link remove problem 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 --- inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inode.c b/inode.c index ce7b585..4d9af5e 100644 --- a/inode.c +++ b/inode.c @@ -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;