tolerate running out of inodes

This commit is contained in:
Robert Morris 2022-08-23 12:26:26 -04:00
parent 948cfbdb1f
commit 7c1810e1ae
3 changed files with 48 additions and 9 deletions

View file

@ -193,7 +193,8 @@ static struct inode* iget(uint dev, uint inum);
// Allocate an inode on device dev.
// Mark it as allocated by giving it type type.
// Returns an unlocked but allocated and referenced inode.
// Returns an unlocked but allocated and referenced inode,
// or NULL if there is no free inode..
struct inode*
ialloc(uint dev, short type)
{
@ -213,7 +214,8 @@ ialloc(uint dev, short type)
}
brelse(bp);
}
panic("ialloc: no inodes");
printf("ialloc: no inodes\n");
return 0;
}
// Copy a modified in-memory inode to disk.

View file

@ -262,8 +262,10 @@ create(char *path, short type, short major, short minor)
return 0;
}
if((ip = ialloc(dp->dev, type)) == 0)
panic("create: ialloc");
if((ip = ialloc(dp->dev, type)) == 0){
iunlockput(dp);
return 0;
}
ilock(ip);
ip->major = major;