提交 aba8423c 创建 作者: Robert Morris's avatar Robert Morris

frans' fixes to iput()

上级 9cec455b
......@@ -322,12 +322,14 @@ iput(struct inode *ip)
acquire(&icache.lock);
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
// inode has no links and no other references: truncate and free.
acquiresleep(&ip->lock);
release(&icache.lock);
itrunc(ip);
ip->type = 0;
iupdate(ip);
acquire(&icache.lock);
ip->flags = 0;
releasesleep(&ip->lock);
}
ip->ref--;
release(&icache.lock);
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论