summaryrefslogtreecommitdiffstats
path: root/fs/ext2/ialloc.c
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@nuclecu.unam.mx>1997-08-06 19:14:48 +0000
committerMiguel de Icaza <miguel@nuclecu.unam.mx>1997-08-06 19:14:48 +0000
commite2819e52a162873ff5061de81bb749831bdb5de9 (patch)
tree6067ea700202750ba335a423696f2972700e5f76 /fs/ext2/ialloc.c
parent17a005074429bbf143e40401f405ae4363e56828 (diff)
Merge to 2.1.38.
IMPORTANT NOTE: I could not figure out what information is the one that should be used for the following files (ie, those that were in our tree, or those that came from Linus' patch), please, check these: include/asm-mips/jazz.h include/asm-mips/jazzdma.h include/asm-mips/ioctls.h
Diffstat (limited to 'fs/ext2/ialloc.c')
-rw-r--r--fs/ext2/ialloc.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index bc16722e4..7a7c6d789 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -290,8 +290,18 @@ struct inode * ext2_new_inode (const struct inode * dir, int mode, int * err)
struct ext2_group_desc * tmp;
struct ext2_super_block * es;
- if (!dir || !(inode = get_empty_inode ()))
+ /* Cannot create files in a deleted directory */
+ if (!dir || !dir->i_nlink) {
+ *err = -EPERM;
return NULL;
+ }
+
+ inode = get_empty_inode ();
+ if (!inode) {
+ *err = -ENOMEM;
+ return NULL;
+ }
+
sb = dir->i_sb;
inode->i_sb = sb;
inode->i_flags = sb->s_flags;