aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Sykes <chris@sigsegv.plus.com>2005-09-28 00:45:23 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-28 10:46:40 -0400
commitdc7b5fd6b0d3beb41f9e5e3a94dd1eadf52209f3 (patch)
tree4ec658a634151c19af2f9b2b184aaa22949ef1a3
parent9ed6c2fb34a1fb493caec8a9644d05bb880a6923 (diff)
[PATCH] Fix ext3_new_inode() failure paths
Fix failure paths in ext3_new_inode() and clean up duplicated code: - DQUOT_DROP() was not being called if ext3_init_security() failed. Signed-off-by: Chris Sykes <chris@sigsegv.plus.com> Cc: Stephen Smalley <sds@epoch.ncsc.mil> Cc: Jan Kara <jack@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/ext3/ialloc.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index 96552769d039..6549945f9ac1 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -597,27 +597,22 @@ got:
597 597
598 ret = inode; 598 ret = inode;
599 if(DQUOT_ALLOC_INODE(inode)) { 599 if(DQUOT_ALLOC_INODE(inode)) {
600 DQUOT_DROP(inode);
601 err = -EDQUOT; 600 err = -EDQUOT;
602 goto fail2; 601 goto fail_drop;
603 } 602 }
603
604 err = ext3_init_acl(handle, inode, dir); 604 err = ext3_init_acl(handle, inode, dir);
605 if (err) { 605 if (err)
606 DQUOT_FREE_INODE(inode); 606 goto fail_free_drop;
607 DQUOT_DROP(inode); 607
608 goto fail2;
609 }
610 err = ext3_init_security(handle,inode, dir); 608 err = ext3_init_security(handle,inode, dir);
611 if (err) { 609 if (err)
612 DQUOT_FREE_INODE(inode); 610 goto fail_free_drop;
613 goto fail2; 611
614 }
615 err = ext3_mark_inode_dirty(handle, inode); 612 err = ext3_mark_inode_dirty(handle, inode);
616 if (err) { 613 if (err) {
617 ext3_std_error(sb, err); 614 ext3_std_error(sb, err);
618 DQUOT_FREE_INODE(inode); 615 goto fail_free_drop;
619 DQUOT_DROP(inode);
620 goto fail2;
621 } 616 }
622 617
623 ext3_debug("allocating inode %lu\n", inode->i_ino); 618 ext3_debug("allocating inode %lu\n", inode->i_ino);
@@ -631,7 +626,11 @@ really_out:
631 brelse(bitmap_bh); 626 brelse(bitmap_bh);
632 return ret; 627 return ret;
633 628
634fail2: 629fail_free_drop:
630 DQUOT_FREE_INODE(inode);
631
632fail_drop:
633 DQUOT_DROP(inode);
635 inode->i_flags |= S_NOQUOTA; 634 inode->i_flags |= S_NOQUOTA;
636 inode->i_nlink = 0; 635 inode->i_nlink = 0;
637 iput(inode); 636 iput(inode);