Skip to content

Commit

Permalink
md: fix regression resulting in delays in clearing bits in a bitmap
Browse files Browse the repository at this point in the history
commit 589a594 (2.6.37-rc4) fixed a problem were md_thread would
sometimes call the ->run function at a bad time.

If an error is detected during array start up after the md_thread has
been started, the md_thread is killed.  This resulted in the ->run
function being called once.  However the array may not be in a state
that it is safe to call ->run.

However the fix imposed meant that  ->run was not called on a timeout.
This means that when an array goes idle, bitmap bits do not get
cleared promptly.  While the array is busy the bits will still be
cleared when appropriate so this is not very serious.  There is no
risk to data.

Change the test so that we only avoid calling ->run when the thread
is being stopped.  This more explicitly addresses the problem situation.

This is suitable for 2.6.37-stable and any -stable kernel to which
589a594 was applied.

Cc: stable@kernel.org
Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
NeilBrown committed Jan 13, 2011
1 parent bf57254 commit 6c98791
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -6042,7 +6042,8 @@ static int md_thread(void * arg)
|| kthread_should_stop(),
thread->timeout);

if (test_and_clear_bit(THREAD_WAKEUP, &thread->flags))
clear_bit(THREAD_WAKEUP, &thread->flags);
if (!kthread_should_stop())
thread->run(thread->mddev);
}

Expand Down

0 comments on commit 6c98791

Please sign in to comment.