linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Jonathan Brassow <jbrassow@redhat.com>
Cc: linux-raid@vger.kernel.org, linux-mm@kvack.org, cl@linux.com
Subject: Re: [PATCH] RAID5: Change kmem_cache name string of RAID 4/5/6 stripe cache
Date: Thu, 10 Oct 2013 15:50:04 -0700	[thread overview]
Message-ID: <52572F1C.8080905@zytor.com> (raw)
In-Reply-To: <1379646960-12553-2-git-send-email-jbrassow@redhat.com>

On 09/19/2013 08:16 PM, Jonathan Brassow wrote:
> The unique portion of the kmem_cache name used when dm-raid is creating
> a RAID 4/5/6 array is the memory address of it's associated 'mddev'
> structure.  This is not always unique.  The memory associated
> with the 'mddev' structure can be freed and a future 'mddev' structure
> can be allocated from the exact same spot.  This causes an identical
> name to the old cache to be created when kmem_cache_create is called.
> If an old name is still present amoung slab_caches due to cache merging,
> the call will fail.  This is not theoretical, I see this regularly when
> performing device-mapper RAID 4/5/6 tests (although, strangely only on
> Fedora-19).
> 
> Making the unique portion of the kmem_cache name based on jiffies fixes
> this problem.
> 
> Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
> ---
>  drivers/md/raid5.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 7ff4f25..f731ce9 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -1618,7 +1618,7 @@ static int grow_stripes(struct r5conf *conf, int num)
>  			"raid%d-%s", conf->level, mdname(conf->mddev));
>  	else
>  		sprintf(conf->cache_name[0],
> -			"raid%d-%p", conf->level, conf->mddev);
> +			"raid%d-%llu", conf->level, get_jiffies_64());
>  	sprintf(conf->cache_name[1], "%s-alt", conf->cache_name[0]);
>  
>  	conf->active_name = 0;
> 

And it is not possible to create two inside the same jiffy?  Seems
unlikely at best.

Why not just use a simple counter?

	-hpa

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2013-10-10 22:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20  3:15 [PATCH] Problems with RAID 4/5/6 and kmem_cache Jonathan Brassow
2013-09-20  3:16 ` [PATCH] RAID5: Change kmem_cache name string of RAID 4/5/6 stripe cache Jonathan Brassow
2013-10-10 22:50   ` H. Peter Anvin [this message]
2013-10-11  2:37     ` Brassow Jonathan
2013-09-21 21:56 ` [PATCH] Problems with RAID 4/5/6 and kmem_cache Christoph Lameter
2013-09-28  6:49   ` Pekka Enberg
2013-10-02 14:43     ` Christoph Lameter

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=52572F1C.8080905@zytor.com \
    --to=hpa@zytor.com \
    --cc=cl@linux.com \
    --cc=jbrassow@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-raid@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