]> git.baikalelectronics.ru Git - kernel.git/commit
md/raid5: simplfy delaying of writes while metadata is updated.
authorNeilBrown <neilb@suse.com>
Wed, 15 Mar 2017 03:05:12 +0000 (14:05 +1100)
committerShaohua Li <shli@fb.com>
Thu, 23 Mar 2017 02:15:57 +0000 (19:15 -0700)
commit1c07006b6d0a6be32e13c01c55f53893a5f28fad
treeae10253861afd7ce27aae967a4cf075f4b2621af
parent6818ae413e1e084c4f37d81ffd00d5663fe4b594
md/raid5: simplfy delaying of writes while metadata is updated.

If a device fails during a write, we must ensure the failure is
recorded in the metadata before the completion of the write is
acknowleged.

Commit f2e95e5d5f18 ("md/raid5: ensure device failure recorded before
write request returns.")  added code for this, but it was
unnecessarily complicated.  We already had similar functionality for
handling updates to the bad-block-list, thanks to Commit af40c7c2b39e
("md: make it easier to wait for bad blocks to be acknowledged.")

So revert most of the former commit, and instead avoid collecting
completed writes if MD_CHANGE_PENDING is set.  raid5d() will then flush
the metadata and retry the stripe_head.
As this change can leave a stripe_head ready for handling immediately
after handle_active_stripes() returns, we change raid5_do_work() to
pause when MD_CHANGE_PENDING is set, so that it doesn't spin.

We check MD_CHANGE_PENDING *after* analyse_stripe() as it could be set
asynchronously.  After analyse_stripe(), we have collected stable data
about the state of devices, which will be used to make decisions.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/raid5.c
drivers/md/raid5.h