* [PATCH] fix up thinko in jbd2 revoke code
@ 2008-03-31 15:57 James Bottomley
2008-03-31 18:30 ` Mingming Cao
0 siblings, 1 reply; 4+ messages in thread
From: James Bottomley @ 2008-03-31 15:57 UTC (permalink / raw)
To: linux-fsdevel; +Cc: Duane Griffin
This commit:
commit e898f3154d78d1520265aade0992981866d827fb
Author: Duane Griffin <duaneg@dghda.com>
Date: Tue Mar 25 19:47:39 2008 -0400
jbd2: tidy up revoke cache initialisation and destruction
Introduced a thinko (it doesn't check whether jbd2_revoke_record cache
is null, it checks jbd2_revoke_table_cache twice).
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
index e13584a..4dc5b85 100644
--- a/fs/jbd2/revoke.c
+++ b/fs/jbd2/revoke.c
@@ -192,7 +192,7 @@ int __init jbd2_journal_init_revoke_caches(void)
jbd2_revoke_table_cache = kmem_cache_create("jbd2_revoke_table",
sizeof(struct jbd2_revoke_table_s),
0, SLAB_TEMPORARY, NULL);
- if (jbd2_revoke_table_cache && jbd2_revoke_table_cache) {
+ if (jbd2_revoke_record_cache && jbd2_revoke_table_cache) {
return 0;
} else {
jbd2_journal_destroy_revoke_caches();
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fix up thinko in jbd2 revoke code
2008-03-31 15:57 [PATCH] fix up thinko in jbd2 revoke code James Bottomley
@ 2008-03-31 18:30 ` Mingming Cao
2008-04-03 16:17 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Mingming Cao @ 2008-03-31 18:30 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-fsdevel, Duane Griffin
On Mon, 2008-03-31 at 10:57 -0500, James Bottomley wrote:
> This commit:
>
> commit e898f3154d78d1520265aade0992981866d827fb
> Author: Duane Griffin <duaneg@dghda.com>
> Date: Tue Mar 25 19:47:39 2008 -0400
>
> jbd2: tidy up revoke cache initialisation and destruction
>
> Introduced a thinko (it doesn't check whether jbd2_revoke_record cache
> is null, it checks jbd2_revoke_table_cache twice).
>
> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Thanks, I picked this up in ext4 patch queue.
Mingming
> ---
>
> diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
> index e13584a..4dc5b85 100644
> --- a/fs/jbd2/revoke.c
> +++ b/fs/jbd2/revoke.c
> @@ -192,7 +192,7 @@ int __init jbd2_journal_init_revoke_caches(void)
> jbd2_revoke_table_cache = kmem_cache_create("jbd2_revoke_table",
> sizeof(struct jbd2_revoke_table_s),
> 0, SLAB_TEMPORARY, NULL);
> - if (jbd2_revoke_table_cache && jbd2_revoke_table_cache) {
> + if (jbd2_revoke_record_cache && jbd2_revoke_table_cache) {
> return 0;
> } else {
> jbd2_journal_destroy_revoke_caches();
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fix up thinko in jbd2 revoke code
2008-03-31 18:30 ` Mingming Cao
@ 2008-04-03 16:17 ` Christoph Hellwig
2008-04-21 9:54 ` Aneesh Kumar K.V
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2008-04-03 16:17 UTC (permalink / raw)
To: Mingming Cao; +Cc: James Bottomley, linux-fsdevel, Duane Griffin
On Mon, Mar 31, 2008 at 11:30:58AM -0700, Mingming Cao wrote:
> On Mon, 2008-03-31 at 10:57 -0500, James Bottomley wrote:
> > This commit:
> >
> > commit e898f3154d78d1520265aade0992981866d827fb
> > Author: Duane Griffin <duaneg@dghda.com>
> > Date: Tue Mar 25 19:47:39 2008 -0400
> >
> > jbd2: tidy up revoke cache initialisation and destruction
> >
> > Introduced a thinko (it doesn't check whether jbd2_revoke_record cache
> > is null, it checks jbd2_revoke_table_cache twice).
> >
> > Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
> >
> Signed-off-by: Mingming Cao <cmm@us.ibm.com>
>
> Thanks, I picked this up in ext4 patch queue.
anyone care to convert this function to proper goto-based error
unwinding?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fix up thinko in jbd2 revoke code
2008-04-03 16:17 ` Christoph Hellwig
@ 2008-04-21 9:54 ` Aneesh Kumar K.V
0 siblings, 0 replies; 4+ messages in thread
From: Aneesh Kumar K.V @ 2008-04-21 9:54 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Mingming Cao, James Bottomley, linux-fsdevel, Duane Griffin,
linux-ext4
On Thu, Apr 03, 2008 at 12:17:27PM -0400, Christoph Hellwig wrote:
> On Mon, Mar 31, 2008 at 11:30:58AM -0700, Mingming Cao wrote:
> > On Mon, 2008-03-31 at 10:57 -0500, James Bottomley wrote:
> > > This commit:
> > >
> > > commit e898f3154d78d1520265aade0992981866d827fb
> > > Author: Duane Griffin <duaneg@dghda.com>
> > > Date: Tue Mar 25 19:47:39 2008 -0400
> > >
> > > jbd2: tidy up revoke cache initialisation and destruction
> > >
> > > Introduced a thinko (it doesn't check whether jbd2_revoke_record cache
> > > is null, it checks jbd2_revoke_table_cache twice).
> > >
> > > Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
> > >
> > Signed-off-by: Mingming Cao <cmm@us.ibm.com>
> >
> > Thanks, I picked this up in ext4 patch queue.
>
> anyone care to convert this function to proper goto-based error
> unwinding?
Like below. ?
Mingming,
I folded jbd2-tidy-up-revoe-cache-intialisation-and-destruction.patch
jbd2-fix-up-thinko-in-jbd2-revoke-code.patch in the patch queue to
this.
-aneesh
jbd2: tidy up revoke cache initialisation and destruction
From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Make revocation cache destruction safe to call if initialisation fails
partially or entirely. This allows it to be used to cleanup in the case of
initialisation failure, simplifying the code slightly.
Signed-off-by: Duane Griffin <duaneg@dghda.com>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
fs/jbd2/revoke.c | 36 ++++++++++++++++++++++--------------
1 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
index 2e1453a..72b2608 100644
--- a/fs/jbd2/revoke.c
+++ b/fs/jbd2/revoke.c
@@ -167,33 +167,41 @@ static struct jbd2_revoke_record_s *find_revoke_record(journal_t *journal,
return NULL;
}
+void jbd2_journal_destroy_revoke_caches(void)
+{
+ if (jbd2_revoke_record_cache) {
+ kmem_cache_destroy(jbd2_revoke_record_cache);
+ jbd2_revoke_record_cache = NULL;
+ }
+ if (jbd2_revoke_table_cache) {
+ kmem_cache_destroy(jbd2_revoke_table_cache);
+ jbd2_revoke_table_cache = NULL;
+ }
+}
+
int __init jbd2_journal_init_revoke_caches(void)
{
+ J_ASSERT(!jbd2_revoke_record_cache);
+ J_ASSERT(!jbd2_revoke_table_cache);
+
jbd2_revoke_record_cache = kmem_cache_create("jbd2_revoke_record",
sizeof(struct jbd2_revoke_record_s),
0,
SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY,
NULL);
if (!jbd2_revoke_record_cache)
- return -ENOMEM;
+ goto record_cache_failure;
jbd2_revoke_table_cache = kmem_cache_create("jbd2_revoke_table",
sizeof(struct jbd2_revoke_table_s),
0, SLAB_TEMPORARY, NULL);
- if (!jbd2_revoke_table_cache) {
- kmem_cache_destroy(jbd2_revoke_record_cache);
- jbd2_revoke_record_cache = NULL;
- return -ENOMEM;
- }
+ if (!jbd2_revoke_table_cache)
+ goto table_cache_failure;
return 0;
-}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-04-21 9:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-31 15:57 [PATCH] fix up thinko in jbd2 revoke code James Bottomley
2008-03-31 18:30 ` Mingming Cao
2008-04-03 16:17 ` Christoph Hellwig
2008-04-21 9:54 ` Aneesh Kumar K.V
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).