md/bitmap: always wait for writes on unplug.
authorNeilBrown <neilb@suse.de>
Tue, 9 Sep 2014 04:13:51 +0000 (14:13 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2015 17:58:15 +0000 (09:58 -0800)
commit15225559b32c87614b39713875f6d799df05c9b0
tree8ddf3cca54744707b05b28011ef3176715204419
parent9d2b6132e6963ccdfb15a4570984382425b96529
md/bitmap: always wait for writes on unplug.

commit 4b5060ddae2b03c5387321fafc089d242225697a upstream.

If two threads call bitmap_unplug at the same time, then
one might schedule all the writes, and the other might
decide that it doesn't need to wait.  But really it does.

It rarely hurts to wait when it isn't absolutely necessary,
and the current code doesn't really focus on 'absolutely necessary'
anyway.  So just wait always.

This can potentially lead to data corruption if a crash happens
at an awkward time and data was written before the bitmap was
updated.  It is very unlikely, but this should go to -stable
just to be safe.  Appropriate for any -stable.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/bitmap.c