frans' fixes to iput()
This commit is contained in:
parent
9cec455b17
commit
aba8423c4a
2
fs.c
2
fs.c
|
@ -322,12 +322,14 @@ iput(struct inode *ip)
|
||||||
acquire(&icache.lock);
|
acquire(&icache.lock);
|
||||||
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
|
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
|
||||||
// inode has no links and no other references: truncate and free.
|
// inode has no links and no other references: truncate and free.
|
||||||
|
acquiresleep(&ip->lock);
|
||||||
release(&icache.lock);
|
release(&icache.lock);
|
||||||
itrunc(ip);
|
itrunc(ip);
|
||||||
ip->type = 0;
|
ip->type = 0;
|
||||||
iupdate(ip);
|
iupdate(ip);
|
||||||
acquire(&icache.lock);
|
acquire(&icache.lock);
|
||||||
ip->flags = 0;
|
ip->flags = 0;
|
||||||
|
releasesleep(&ip->lock);
|
||||||
}
|
}
|
||||||
ip->ref--;
|
ip->ref--;
|
||||||
release(&icache.lock);
|
release(&icache.lock);
|
||||||
|
|
Loading…
Reference in a new issue