* Patch "RAID5: check_reshape() shouldn't call mddev_suspend" has been added to the 4.4-stable tree
@ 2016-04-10 17:28 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-04-10 17:28 UTC (permalink / raw)
To: shli, artur.paszkiewicz, gregkh, neilb; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
RAID5: check_reshape() shouldn't call mddev_suspend
to the 4.4-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:
raid5-check_reshape-shouldn-t-call-mddev_suspend.patch
and it can be found in the queue-4.4 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 27a353c026a879a1001e5eac4bda75b16262c44a Mon Sep 17 00:00:00 2001
From: Shaohua Li <shli@fb.com>
Date: Wed, 24 Feb 2016 17:38:28 -0800
Subject: RAID5: check_reshape() shouldn't call mddev_suspend
From: Shaohua Li <shli@fb.com>
commit 27a353c026a879a1001e5eac4bda75b16262c44a upstream.
check_reshape() is called from raid5d thread. raid5d thread shouldn't
call mddev_suspend(), because mddev_suspend() waits for all IO finish
but IO is handled in raid5d thread, we could easily deadlock here.
This issue is introduced by
738a273 ("md/raid5: fix allocation of 'scribble' array.")
Reported-and-tested-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/raid5.c | 18 ++++++++++++++++++
drivers/md/raid5.h | 2 ++
2 files changed, 20 insertions(+)
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2091,6 +2091,14 @@ static int resize_chunks(struct r5conf *
unsigned long cpu;
int err = 0;
+ /*
+ * Never shrink. And mddev_suspend() could deadlock if this is called
+ * from raid5d. In that case, scribble_disks and scribble_sectors
+ * should equal to new_disks and new_sectors
+ */
+ if (conf->scribble_disks >= new_disks &&
+ conf->scribble_sectors >= new_sectors)
+ return 0;
mddev_suspend(conf->mddev);
get_online_cpus();
for_each_present_cpu(cpu) {
@@ -2112,6 +2120,10 @@ static int resize_chunks(struct r5conf *
}
put_online_cpus();
mddev_resume(conf->mddev);
+ if (!err) {
+ conf->scribble_disks = new_disks;
+ conf->scribble_sectors = new_sectors;
+ }
return err;
}
@@ -6414,6 +6426,12 @@ static int raid5_alloc_percpu(struct r5c
}
put_online_cpus();
+ if (!err) {
+ conf->scribble_disks = max(conf->raid_disks,
+ conf->previous_raid_disks);
+ conf->scribble_sectors = max(conf->chunk_sectors,
+ conf->prev_chunk_sectors);
+ }
return err;
}
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -510,6 +510,8 @@ struct r5conf {
* conversions
*/
} __percpu *percpu;
+ int scribble_disks;
+ int scribble_sectors;
#ifdef CONFIG_HOTPLUG_CPU
struct notifier_block cpu_notify;
#endif
Patches currently in stable-queue which might be from shli@fb.com are
queue-4.4/raid10-include-bio_end_io_list-in-nr_queued-to-prevent-freeze_array-hang.patch
queue-4.4/md-multipath-don-t-hardcopy-bio-in-.make_request-path.patch
queue-4.4/raid5-revert-e9e4c377e2f563-to-fix-a-livelock.patch
queue-4.4/raid1-include-bio_end_io_list-in-nr_queued-to-prevent-freeze_array-hang.patch
queue-4.4/raid5-check_reshape-shouldn-t-call-mddev_suspend.patch
queue-4.4/md-raid5-compare-apples-to-apples-or-sectors-to-sectors.patch
queue-4.4/md-raid5-preserve-stripe_preread_active-in-break_stripe_batch_list.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-04-10 17:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-10 17:28 Patch "RAID5: check_reshape() shouldn't call mddev_suspend" has been added to the 4.4-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.