linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] jbd2: set to NULL after kmem_cache_destroy
@ 2018-02-05 13:39 Wang Long
  2018-02-05 17:00 ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Wang Long @ 2018-02-05 13:39 UTC (permalink / raw)
  To: tytso, jack; +Cc: linux-ext4, linux-kernel, wanglong19

Signed-off-by: Wang Long <wanglong19@meituan.com>
---
 fs/jbd2/journal.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 93016bb..38dc24c 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -2649,11 +2649,14 @@ static int __init jbd2_journal_init_handle_cache(void)
 
 static void jbd2_journal_destroy_handle_cache(void)
 {
-	if (jbd2_handle_cache)
+	if (jbd2_handle_cache) {
 		kmem_cache_destroy(jbd2_handle_cache);
-	if (jbd2_inode_cache)
+		jbd2_handle_cache = NULL;
+	}
+	if (jbd2_inode_cache) {
 		kmem_cache_destroy(jbd2_inode_cache);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] jbd2: set to NULL after kmem_cache_destroy
  2018-02-05 13:39 [PATCH] jbd2: set to NULL after kmem_cache_destroy Wang Long
@ 2018-02-05 17:00 ` Darrick J. Wong
  2018-02-06  2:29   ` Wang Long
  0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2018-02-05 17:00 UTC (permalink / raw)
  To: Wang Long; +Cc: tytso, jack, linux-ext4, linux-kernel

On Mon, Feb 05, 2018 at 09:39:17PM +0800, Wang Long wrote:
> Signed-off-by: Wang Long <wanglong19@meituan.com>
> ---
>  fs/jbd2/journal.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index 93016bb..38dc24c 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -2649,11 +2649,14 @@ static int __init jbd2_journal_init_handle_cache(void)
>  
>  static void jbd2_journal_destroy_handle_cache(void)
>  {
> -	if (jbd2_handle_cache)
> +	if (jbd2_handle_cache) {
>  		kmem_cache_destroy(jbd2_handle_cache);

kmem_cache_destroy already handles null pointers, so you can remove the
conditional test entirely.

--D

> -	if (jbd2_inode_cache)
> +		jbd2_handle_cache = NULL;
> +	}
> +	if (jbd2_inode_cache) {
>  		kmem_cache_destroy(jbd2_inode_cache);
> -
> +		jbd2_inode_cache = NULL;
> +	}
>  }
>  
>  /*
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] jbd2: set to NULL after kmem_cache_destroy
  2018-02-05 17:00 ` Darrick J. Wong
@ 2018-02-06  2:29   ` Wang Long
  0 siblings, 0 replies; 3+ messages in thread
From: Wang Long @ 2018-02-06  2:29 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: tytso, jack, linux-ext4, linux-kernel


On 6/2/2018 1:00 AM, Darrick J. Wong wrote:
> On Mon, Feb 05, 2018 at 09:39:17PM +0800, Wang Long wrote:
>> Signed-off-by: Wang Long <wanglong19@meituan.com>
>> ---
>>   fs/jbd2/journal.c | 9 ++++++---
>>   1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
>> index 93016bb..38dc24c 100644
>> --- a/fs/jbd2/journal.c
>> +++ b/fs/jbd2/journal.c
>> @@ -2649,11 +2649,14 @@ static int __init jbd2_journal_init_handle_cache(void)
>>   
>>   static void jbd2_journal_destroy_handle_cache(void)
>>   {
>> -	if (jbd2_handle_cache)
>> +	if (jbd2_handle_cache) {
>>   		kmem_cache_destroy(jbd2_handle_cache);
> kmem_cache_destroy already handles null pointers, so you can remove the
> conditional test entirely.
>
> --D
Thanks, I will send another patch to remove all conditional test in 
module JBD2.
>> -	if (jbd2_inode_cache)
>> +		jbd2_handle_cache = NULL;
>> +	}
>> +	if (jbd2_inode_cache) {
>>   		kmem_cache_destroy(jbd2_inode_cache);
>> -
>> +		jbd2_inode_cache = NULL;
>> +	}
>>   }
>>   
>>   /*
>> -- 
>> 1.8.3.1
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-06  2:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-05 13:39 [PATCH] jbd2: set to NULL after kmem_cache_destroy Wang Long
2018-02-05 17:00 ` Darrick J. Wong
2018-02-06  2:29   ` Wang Long

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).