diff options
Diffstat (limited to 'ext2fs/ialloc.c')
-rw-r--r-- | ext2fs/ialloc.c | 11 |
1 files changed, 10 insertions, 1 deletions
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; |