linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chengguang Xu <cgxu519@gmail.com>
To: jack@suse.com, tytso@mit.edu
Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chengguang Xu <cgxu519@gmail.com>
Subject: [PATCH 2/3] jbd2: code cleanup for jbd2_journal_init_revoke_caches()
Date: Sun,  5 May 2019 19:01:03 +0800	[thread overview]
Message-ID: <1557054064-3504-2-git-send-email-cgxu519@gmail.com> (raw)
In-Reply-To: <1557054064-3504-1-git-send-email-cgxu519@gmail.com>

jbd2_journal_destroy_caches() can handle destruction work
for all caches, so we don't have to destroy previously
created cache in error path, it also makes the code simpler.

Signed-off-by: Chengguang Xu <cgxu519@gmail.com>
---
 fs/jbd2/revoke.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
index a1143e57a718..3b46b45d085d 100644
--- a/fs/jbd2/revoke.c
+++ b/fs/jbd2/revoke.c
@@ -194,17 +194,14 @@ int __init jbd2_journal_init_revoke_caches(void)
 	jbd2_revoke_record_cache = KMEM_CACHE(jbd2_revoke_record_s,
 					SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY);
 	if (!jbd2_revoke_record_cache)
-		goto record_cache_failure;
+		return -ENOMEM;
 
 	jbd2_revoke_table_cache = KMEM_CACHE(jbd2_revoke_table_s,
 					     SLAB_TEMPORARY);
 	if (!jbd2_revoke_table_cache)
-		goto table_cache_failure;
-	return 0;
-table_cache_failure:
-	jbd2_journal_destroy_revoke_caches();
-record_cache_failure:
 		return -ENOMEM;
+
+	return 0;
 }
 
 static struct jbd2_revoke_table_s *jbd2_journal_init_revoke_table(int hash_size)
-- 
2.20.1


  reply	other threads:[~2019-05-05 11:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-05 11:01 [PATCH 1/3] jbd2: fix potential double free Chengguang Xu
2019-05-05 11:01 ` Chengguang Xu [this message]
2019-05-05 11:01 ` [PATCH 3/3] jbd2: add __init annotation for jbd2_journal_init_journal_head_cache() Chengguang Xu
2019-05-08  6:38 ` [PATCH 1/3] jbd2: fix potential double free sunny.s.zhang
2019-05-09 10:42   ` Jan Kara

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=1557054064-3504-2-git-send-email-cgxu519@gmail.com \
    --to=cgxu519@gmail.com \
    --cc=jack@suse.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).