From 7b913237af5fdd4530bfedc1413cc2624cdfb784 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Wed, 19 Apr 1995 01:34:15 +0000 Subject: Formerly ialloc.c.~16~ --- ext2fs/ialloc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'ext2fs/ialloc.c') diff --git a/ext2fs/ialloc.c b/ext2fs/ialloc.c index 2a733909..43deda75 100644 --- a/ext2fs/ialloc.c +++ b/ext2fs/ialloc.c @@ -57,6 +57,10 @@ diskfs_free_node (struct node *np, mode_t old_mode) struct ext2_group_desc *gdp; ino_t inum = np->dn->number; + if (diskfs_readonly) + ext2_panic ("diskfs_free_node", + "Freeing inode %d on a readonly filesystem", inum); + ext2_debug ("freeing inode %lu\n", inum); spin_lock (&global_lock); @@ -273,7 +277,12 @@ diskfs_alloc_node (struct node *dir, mode_t mode, struct node **node) error_t err; int sex; struct node *np; - ino_t inum = ext2_alloc_inode (dir->dn->number, mode); + ino_t inum; + + if (diskfs_readonly) + return EROFS; + + inum = ext2_alloc_inode (dir->dn->number, mode); if (inum == 0) return ENOSPC; -- cgit v1.2.3