summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fs.c6
-rw-r--r--kernel/sysfile.c6
2 files changed, 8 insertions, 4 deletions
diff --git a/kernel/fs.c b/kernel/fs.c
index b220491..dea5864 100644
--- a/kernel/fs.c
+++ b/kernel/fs.c
@@ -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.
diff --git a/kernel/sysfile.c b/kernel/sysfile.c
index d8a6fca..16b668c 100644
--- a/kernel/sysfile.c
+++ b/kernel/sysfile.c
@@ -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;