--- /dev/null
+From ed209584c38fb74b7eecc03e5b1bfe674e591bd8 Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.de>
+Date: Tue, 24 Apr 2012 10:23:14 +1000
+Subject: md: don't call ->add_disk unless there is good reason.
+
+From: NeilBrown <neilb@suse.de>
+
+commit ed209584c38fb74b7eecc03e5b1bfe674e591bd8 upstream.
+
+Commit 7bfec5f35c68121e7b18
+
+ md/raid5: If there is a spare and a want_replacement device, start replacement.
+
+cause md_check_recovery to call ->add_disk much more often.
+Instead of only when the array is degraded, it is now called whenever
+md_check_recovery finds anything useful to do, which includes
+updating the metadata for clean<->dirty transition.
+This causes unnecessary work, and causes info messages from ->add_disk
+to be reported much too often.
+
+So refine md_check_recovery to only do any actual recovery checking
+(including ->add_disk) if MD_RECOVERY_NEEDED is set.
+
+This fix is suitable for 3.3.y:
+
+Reported-by: Jan Ceuleers <jan.ceuleers@computer.org>
+Signed-off-by: NeilBrown <neilb@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/md/md.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -7580,14 +7580,14 @@ void md_check_recovery(struct mddev *mdd
+ * any transients in the value of "sync_action".
+ */
+ set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
+- clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
+ /* Clear some bits that don't mean anything, but
+ * might be left set
+ */
+ clear_bit(MD_RECOVERY_INTR, &mddev->recovery);
+ clear_bit(MD_RECOVERY_DONE, &mddev->recovery);
+
+- if (test_bit(MD_RECOVERY_FROZEN, &mddev->recovery))
++ if (!test_and_clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery) ||
++ test_bit(MD_RECOVERY_FROZEN, &mddev->recovery))
+ goto unlock;
+ /* no recovery is running.
+ * remove any failed drives, then
--- /dev/null
+From 30b8aa9172dfeaac6d77897c67ee9f9fc574cdbb Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.de>
+Date: Tue, 24 Apr 2012 10:23:16 +1000
+Subject: md: fix possible corruption of array metadata on shutdown.
+
+From: NeilBrown <neilb@suse.de>
+
+commit 30b8aa9172dfeaac6d77897c67ee9f9fc574cdbb upstream.
+
+commit c744a65c1e2d59acc54333ce8
+ md: don't set md arrays to readonly on shutdown.
+
+removed the possibility of a 'BUG' when data is written to an array
+that has just been switched to read-only, but also introduced the
+possibility that the array metadata could be corrupted.
+
+If, when md_notify_reboot gets the mddev lock, the array is
+in a state where it is assembled but hasn't been started (as can
+happen if the personality module is not available, or in other unusual
+situations), then incorrect metadata will be written out making it
+impossible to re-assemble the array.
+
+So only call __md_stop_writes() if the array has actually been
+activated.
+
+This patch is needed for any stable kernel which has had the above
+commit applied.
+
+Reported-by: Christoph Nelles <evilazrael@evilazrael.de>
+Signed-off-by: NeilBrown <neilb@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/md/md.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -8160,7 +8160,8 @@ static int md_notify_reboot(struct notif
+
+ for_each_mddev(mddev, tmp) {
+ if (mddev_trylock(mddev)) {
+- __md_stop_writes(mddev);
++ if (mddev->pers)
++ __md_stop_writes(mddev);
+ mddev->safemode = 2;
+ mddev_unlock(mddev);
+ }
--- /dev/null
+From aca50bd3b4c4bb5528a1878158ba7abce41de534 Mon Sep 17 00:00:00 2001
+From: Hugh Dickins <hughd@google.com>
+Date: Mon, 23 Apr 2012 11:14:50 -0700
+Subject: mm: fix s390 BUG by __set_page_dirty_no_writeback on swap
+
+From: Hugh Dickins <hughd@google.com>
+
+commit aca50bd3b4c4bb5528a1878158ba7abce41de534 upstream.
+
+Mel reports a BUG_ON(slot == NULL) in radix_tree_tag_set() on s390
+3.0.13: called from __set_page_dirty_nobuffers() when page_remove_rmap()
+tries to transfer dirty flag from s390 storage key to struct page and
+radix_tree.
+
+That would be because of reclaim's shrink_page_list() calling
+add_to_swap() on this page at the same time: first PageSwapCache is set
+(causing page_mapping(page) to appear as &swapper_space), then
+page->private set, then tree_lock taken, then page inserted into
+radix_tree - so there's an interval before taking the lock when the
+radix_tree slot is empty.
+
+We could fix this by moving __add_to_swap_cache()'s spin_lock_irq up
+before the SetPageSwapCache. But a better fix is simply to do what's
+five years overdue: Ken Chen introduced __set_page_dirty_no_writeback()
+(if !PageDirty TestSetPageDirty) for tmpfs to skip all the radix_tree
+overhead, and swap is just the same - it ignores the radix_tree tag, and
+does not participate in dirty page accounting, so should be using
+__set_page_dirty_no_writeback() too.
+
+s390 testing now confirms that this does indeed fix the problem.
+
+Reported-by: Mel Gorman <mgorman@suse.de>
+Signed-off-by: Hugh Dickins <hughd@google.com>
+Acked-by: Mel Gorman <mgorman@suse.de>
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
+Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
+Cc: Rik van Riel <riel@redhat.com>
+Cc: Ken Chen <kenchen@google.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/swap_state.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/mm/swap_state.c
++++ b/mm/swap_state.c
+@@ -26,7 +26,7 @@
+ */
+ static const struct address_space_operations swap_aops = {
+ .writepage = swap_writepage,
+- .set_page_dirty = __set_page_dirty_nobuffers,
++ .set_page_dirty = __set_page_dirty_no_writeback,
+ .migratepage = migrate_page,
+ };
+
cfg80211-fix-interface-combinations-check.patch
staging-r8712u-fix-regression-caused-by-commit-8c213fa.patch
fix-modpost-failures-in-fedora-17.patch
+mm-fix-s390-bug-by-__set_page_dirty_no_writeback-on-swap.patch
+md-don-t-call-add_disk-unless-there-is-good-reason.patch
+md-fix-possible-corruption-of-array-metadata-on-shutdown.patch