md/raid5: schedule_construction should abort if nothing to do.
authorNeilBrown <neilb@suse.de>
Mon, 4 Mar 2013 01:37:14 +0000 (12:37 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Mar 2013 19:18:01 +0000 (12:18 -0700)
commitbcfe2cfc58bc50d69854365871526e243cd83f19
tree1e9d64968772a486ff3bb03221062848bf5141d5
parent0e1317e914d6bae271c13d473d3e2d69ec9b7b23
md/raid5: schedule_construction should abort if nothing to do.

commit ce7d363aaf1e28be8406a2976220944ca487e8ca upstream.

Since commit 1ed850f356a0a422013846b5291acff08815008b
    md/raid5: make sure to_read and to_write never go negative.

It has been possible for handle_stripe_dirtying to be called
when there isn't actually any work to do.
It then calls schedule_reconstruction() which will set R5_LOCKED
on the parity block(s) even when nothing else is happening.
This then causes problems in do_release_stripe().

So add checks to schedule_reconstruction() so that if it doesn't
find anything to do, it just aborts.

This bug was introduced in v3.7, so the patch is suitable
for -stable kernels since then.

Reported-by: majianpeng <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/raid5.c