Skip to content

Commit aba8423

Browse files
author
Robert Morris
committed
frans' fixes to iput()
1 parent 9cec455 commit aba8423

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs.c

+2
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,14 @@ iput(struct inode *ip)
322322
acquire(&icache.lock);
323323
if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
324324
// inode has no links and no other references: truncate and free.
325+
acquiresleep(&ip->lock);
325326
release(&icache.lock);
326327
itrunc(ip);
327328
ip->type = 0;
328329
iupdate(ip);
329330
acquire(&icache.lock);
330331
ip->flags = 0;
332+
releasesleep(&ip->lock);
331333
}
332334
ip->ref--;
333335
release(&icache.lock);

0 commit comments

Comments
 (0)