* Patch "md/raid5: don't let shrink_slab shrink too far." has been added to the 4.1-stable tree
@ 2015-09-26 17:26 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2015-09-26 17:26 UTC (permalink / raw)
To: neilb, gregkh, tomas.papan; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
md/raid5: don't let shrink_slab shrink too far.
to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
md-raid5-don-t-let-shrink_slab-shrink-too-far.patch
and it can be found in the queue-4.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From 49895bcc7e566ba455eb2996607d6fbd3447ce16 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Mon, 3 Aug 2015 17:09:57 +1000
Subject: md/raid5: don't let shrink_slab shrink too far.
From: NeilBrown <neilb@suse.com>
commit 49895bcc7e566ba455eb2996607d6fbd3447ce16 upstream.
I have a report of drop_one_stripe() called from
raid5_cache_scan() apparently finding ->max_nr_stripes == 0.
This should not be allowed.
So add a test to keep max_nr_stripes above min_nr_stripes.
Also use a 'mask' rather than a 'mod' in drop_one_stripe
to ensure 'hash' is valid even if max_nr_stripes does reach zero.
Fixes: edbe83ab4c27 ("md/raid5: allow the stripe_cache to grow and shrink.")
Reported-by: Tomas Papan <tomas.papan@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/raid5.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2245,7 +2245,7 @@ static int resize_stripes(struct r5conf
static int drop_one_stripe(struct r5conf *conf)
{
struct stripe_head *sh;
- int hash = (conf->max_nr_stripes - 1) % NR_STRIPE_HASH_LOCKS;
+ int hash = (conf->max_nr_stripes - 1) & STRIPE_HASH_LOCKS_MASK;
spin_lock_irq(conf->hash_locks + hash);
sh = get_free_stripe(conf, hash);
@@ -6375,7 +6375,8 @@ static unsigned long raid5_cache_scan(st
if (mutex_trylock(&conf->cache_size_mutex)) {
ret= 0;
- while (ret < sc->nr_to_scan) {
+ while (ret < sc->nr_to_scan &&
+ conf->max_nr_stripes > conf->min_nr_stripes) {
if (drop_one_stripe(conf) == 0) {
ret = SHRINK_STOP;
break;
Patches currently in stable-queue which might be from neilb@suse.com are
queue-4.1/md-raid5-avoid-races-when-changing-cache-size.patch
queue-4.1/md-flush-event_work-before-stopping-array.patch
queue-4.1/md-raid5-don-t-let-shrink_slab-shrink-too-far.patch
queue-4.1/nfsv4-don-t-set-setattr-for-o_rdonly-o_excl.patch
queue-4.1/md-raid10-always-set-reshape_safe-when-initializing-reshape_position.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-09-26 17:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-26 17:26 Patch "md/raid5: don't let shrink_slab shrink too far." has been added to the 4.1-stable tree gregkh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.