linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Sykes <chris@sigsegv.plus.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>, ext2-devel@lists.sourceforge.net
Subject: [PATCH]: Fix ext2_new_inode() failure paths
Date: Sat, 24 Sep 2005 16:47:23 +0100	[thread overview]
Message-ID: <20050924154723.GA5396@sigsegv.plus.com> (raw)
In-Reply-To: <20050924142825.GA5158@sigsegv.plus.com>

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


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

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

  reply	other threads:[~2005-09-24 15:47 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             ` Chris Sykes [this message]
2005-09-24 17:33             ` [PATCH]: Fix ext3_new_inode() failure paths Chris Sykes
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=20050924154723.GA5396@sigsegv.plus.com \
    --to=chris@sigsegv.plus.com \
    --cc=akpm@osdl.org \
    --cc=ext2-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).