lkml.org 
[lkml]   [2005]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH]: Fix ext2_new_inode() failure paths

Fix failure paths in ext2_new_inode() and clean up duplicated code:
- DQUOT_DROP() is now called in ext2_init_security() failure path.

Signed-off-by: Chris Sykes <chris@sigsegv.plus.com>

diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -605,27 +605,28 @@ got:
insert_inode_hash(inode);

if (DQUOT_ALLOC_INODE(inode)) {
- DQUOT_DROP(inode);
err = -ENOSPC;
- goto fail2;
+ goto fail_drop;
}
+
err = ext2_init_acl(inode, dir);
- if (err) {
- DQUOT_FREE_INODE(inode);
- DQUOT_DROP(inode);
- goto fail2;
- }
+ if (err)
+ goto fail_free_drop;
+
err = ext2_init_security(inode,dir);
- if (err) {
- DQUOT_FREE_INODE(inode);
- goto fail2;
- }
+ if (err)
+ goto fail_free_drop;
+
mark_inode_dirty(inode);
ext2_debug("allocating inode %lu\n", inode->i_ino);
ext2_preread_inode(inode);
return inode;

-fail2:
+fail_free_drop:
+ DQUOT_FREE_INODE(inode);
+
+fail_drop:
+ DQUOT_DROP(inode);
inode->i_flags |= S_NOQUOTA;
inode->i_nlink = 0;
iput(inode);
--

(o- Chris Sykes
//\ "Don't worry. Everything is getting nicely out of control ..."
V_/_ Douglas Adams - The Salmon of Doubt
GPG Fingerprint: 5E8E D17F F96C CC08 911D CAF2 9049 70D8 5143 8090
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-09-24 17:54    [W:0.288 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site