+ md-delay-starting-md-threads-until-array-is-completely-setup.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     md: delay starting md threads until array is completely setup

has been added to the -mm tree.  Its filename is

     md-delay-starting-md-threads-until-array-is-completely-setup.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: md: delay starting md threads until array is completely setup
From: NeilBrown <neilb@xxxxxxx>

When an array is started we start one or two threads (two if there is a
reshape or recovery that needs to be completed).

We currently start these *before* the array is completely set up and in
particular before queue->queuedata is set.  If the thread actually starts
very quickly on another CPU, we can end up dereferencing queue->queuedata
and oops.

This patch also makes sure we don't try to start a recovery if a reshape is
being restarted.


Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/md/md.c    |    8 ++++----
 drivers/md/raid5.c |    3 ---
 2 files changed, 4 insertions(+), 7 deletions(-)

diff -puN drivers/md/md.c~md-delay-starting-md-threads-until-array-is-completely-setup drivers/md/md.c
--- a/drivers/md/md.c~md-delay-starting-md-threads-until-array-is-completely-setup
+++ a/drivers/md/md.c
@@ -3100,7 +3100,6 @@ static int do_md_run(mddev_t * mddev)
 		}
 	
 	set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
-	md_wakeup_thread(mddev->thread);
 	
 	if (mddev->sb_dirty)
 		md_update_sb(mddev);
@@ -3121,7 +3120,7 @@ static int do_md_run(mddev_t * mddev)
 	 * start recovery here.  If we leave it to md_check_recovery,
 	 * it will remove the drives and not do the right thing
 	 */
-	if (mddev->degraded) {
+	if (mddev->degraded && !mddev->sync_thread) {
 		struct list_head *rtmp;
 		int spares = 0;
 		ITERATE_RDEV(mddev,rdev,rtmp)
@@ -3142,10 +3141,11 @@ static int do_md_run(mddev_t * mddev)
 				       mdname(mddev));
 				/* leave the spares where they are, it shouldn't hurt */
 				mddev->recovery = 0;
-			} else
-				md_wakeup_thread(mddev->sync_thread);
+			}
 		}
 	}
+	md_wakeup_thread(mddev->thread);
+	md_wakeup_thread(mddev->sync_thread); /* possibly kick off a reshape */
 
 	mddev->changed = 1;
 	md_new_event(mddev);
diff -puN drivers/md/raid5.c~md-delay-starting-md-threads-until-array-is-completely-setup drivers/md/raid5.c
--- a/drivers/md/raid5.c~md-delay-starting-md-threads-until-array-is-completely-setup
+++ a/drivers/md/raid5.c
@@ -3247,9 +3247,6 @@ static int run(mddev_t *mddev)
 		set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
 		mddev->sync_thread = md_register_thread(md_do_sync, mddev,
 							"%s_reshape");
-		/* FIXME if md_register_thread fails?? */
-		md_wakeup_thread(mddev->sync_thread);
-
 	}
 
 	/* read-ahead size must cover two whole stripes, which is
_

Patches currently in -mm which might be from neilb@xxxxxxx are

origin.patch
generic_file_buffered_write-deadlock-on-vectored-write.patch
md-possible-fix-for-unplug-problem.patch
md-set-desc_nr-correctly-for-version-1-superblocks.patch
md-delay-starting-md-threads-until-array-is-completely-setup.patch
md-fix-resync-speed-calculation-for-restarted-resyncs.patch
md-fix-a-plug-unplug-race-in-raid5.patch
md-fix-some-small-races-in-bitmap-plugging-in-raid5.patch
md-fix-usage-of-wrong-variable-in-raid1.patch
md-unify-usage-of-symbolic-names-for-perms.patch
md-require-cap_sys_admin-for-re-configuring-md-devices-via-sysfs.patch
md-fix-will-configure-message-when-interpreting-md=-kernel-parameter.patch
md-include-sector-number-in-messages-about-corrected-read-errors.patch
md-dm-reduce-stack-usage-with-stacked-block-devices.patch
lockdep-annotate-sunrpc-code.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux