Commit b1b02fe9 authored by NeilBrown's avatar NeilBrown

md/raid5: fix another livelock caused by non-aligned writes.

If a non-page-aligned write is destined for a device which
is missing/faulty, we can deadlock.

As the target device is missing, a read-modify-write cycle
is not possible.
As the write is not for a full-page, a recontruct-write cycle
is not possible.

This should be handled by logic in fetch_block() which notices
there is a non-R5_OVERWRITE write to a missing device, and so
loads all blocks.

However since commit 67f45548, that code requires
STRIPE_PREREAD_ACTIVE before it will active, and those circumstances
never set STRIPE_PREREAD_ACTIVE.

So: in handle_stripe_dirtying, if neither rmw or rcw was possible,
set STRIPE_DELAYED, which will cause STRIPE_PREREAD_ACTIVE be set
after a suitable delay.

Fixes: 67f45548
Cc: stable@vger.kernel.org (v3.16+)
Reported-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Tested-by: default avatarHeinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 59343cd7
...@@ -3195,6 +3195,11 @@ static void handle_stripe_dirtying(struct r5conf *conf, ...@@ -3195,6 +3195,11 @@ static void handle_stripe_dirtying(struct r5conf *conf,
(unsigned long long)sh->sector, (unsigned long long)sh->sector,
rcw, qread, test_bit(STRIPE_DELAYED, &sh->state)); rcw, qread, test_bit(STRIPE_DELAYED, &sh->state));
} }
if (rcw > disks && rmw > disks &&
!test_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
set_bit(STRIPE_DELAYED, &sh->state);
/* now if nothing is locked, and if we have enough data, /* now if nothing is locked, and if we have enough data,
* we can start a write request * we can start a write request
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment