提交 76b0c26a 编写于 作者: R Roman Zippel 提交者: Linus Torvalds

HFS+: fix unlink of links

Some time ago while attempting to handle invalid link counts, I botched
the unlink of links itself, so this patch fixes this now correctly, so
that only the link count of nodes that don't point to links is ignored.
Thanks to Vlado Plaga <rechner@vlado-do.de> to notify me of this
problem.
Signed-off-by: NRoman Zippel <zippel@linux-m68k.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 f4be31ec
...@@ -340,16 +340,23 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry) ...@@ -340,16 +340,23 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
if (inode->i_nlink > 0) if (inode->i_nlink > 0)
drop_nlink(inode); drop_nlink(inode);
hfsplus_delete_inode(inode); if (inode->i_ino == cnid)
if (inode->i_ino != cnid && !inode->i_nlink) { clear_nlink(inode);
if (!atomic_read(&HFSPLUS_I(inode).opencnt)) { if (!inode->i_nlink) {
res = hfsplus_delete_cat(inode->i_ino, HFSPLUS_SB(sb).hidden_dir, NULL); if (inode->i_ino != cnid) {
if (!res) HFSPLUS_SB(sb).file_count--;
hfsplus_delete_inode(inode); if (!atomic_read(&HFSPLUS_I(inode).opencnt)) {
res = hfsplus_delete_cat(inode->i_ino,
HFSPLUS_SB(sb).hidden_dir,
NULL);
if (!res)
hfsplus_delete_inode(inode);
} else
inode->i_flags |= S_DEAD;
} else } else
inode->i_flags |= S_DEAD; hfsplus_delete_inode(inode);
} else } else
clear_nlink(inode); HFSPLUS_SB(sb).file_count--;
inode->i_ctime = CURRENT_TIME_SEC; inode->i_ctime = CURRENT_TIME_SEC;
mark_inode_dirty(inode); mark_inode_dirty(inode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册