public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Sykes <chris@sigsegv.plus.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>, sct@redhat.com
Subject: [PATCH]: Fix ext3_new_inode() failure paths
Date: Sat, 24 Sep 2005 18:33:48 +0100	[thread overview]
Message-ID: <20050924173348.GA5104@sigsegv.plus.com> (raw)
In-Reply-To: <20050924142825.GA5158@sigsegv.plus.com>

[-- Attachment #1: Type: text/plain, Size: 1512 bytes --]


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

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

diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -597,27 +597,22 @@ got:
 
 	ret = inode;
 	if(DQUOT_ALLOC_INODE(inode)) {
-		DQUOT_DROP(inode);
 		err = -EDQUOT;
-		goto fail2;
+		goto fail_drop;
 	}
+
 	err = ext3_init_acl(handle, inode, dir);
-	if (err) {
-		DQUOT_FREE_INODE(inode);
-		DQUOT_DROP(inode);
-		goto fail2;
-  	}
+	if (err)
+		goto fail_free_drop;
+
 	err = ext3_init_security(handle,inode, dir);
-	if (err) {
-		DQUOT_FREE_INODE(inode);
-		goto fail2;
-	}
+	if (err)
+		goto fail_free_drop;
+
 	err = ext3_mark_inode_dirty(handle, inode);
 	if (err) {
 		ext3_std_error(sb, err);
-		DQUOT_FREE_INODE(inode);
-		DQUOT_DROP(inode);
-		goto fail2;
+		goto fail_free_drop;
 	}
 
 	ext3_debug("allocating inode %lu\n", inode->i_ino);
@@ -631,7 +626,11 @@ really_out:
 	brelse(bitmap_bh);
 	return ret;
 
-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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2005-09-24 17:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-22 16:37 Hang during rm on ext2 mounted sync (2.6.14-rc2+) Chris Sykes
2005-09-22 20:49 ` Chris Sykes
2005-09-23  8:57 ` Andrew Morton
2005-09-23 12:19   ` Chris Sykes
2005-09-23 13:22     ` Chris Sykes
2005-09-23 19:18       ` Andrew Morton
2005-09-23 19:45         ` Jesper Juhl
2005-09-23 19:47           ` Andrew Morton
2005-09-23 20:11           ` Alexey Dobriyan
2005-09-23 20:06             ` Jesper Juhl
2005-09-23 20:23               ` Andrew Morton
2005-09-23 20:51                 ` Jesper Juhl
2005-09-24 12:14         ` Chris Sykes
2005-09-24 14:28           ` Chris Sykes
2005-09-24 15:47             ` [PATCH]: Fix ext2_new_inode() failure paths Chris Sykes
2005-09-24 17:33             ` Chris Sykes [this message]
2005-09-24 17:39             ` Hang during rm on ext2 mounted sync (2.6.14-rc2+) Andrew Morton
2005-09-25 10:56               ` Chris Sykes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050924173348.GA5104@sigsegv.plus.com \
    --to=chris@sigsegv.plus.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sct@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox