]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
md/raid1: extend spinlock to protect raid1_end_read_request against inconsistencies
authorNeilBrown <neilb@suse.com>
Mon, 27 Jul 2015 01:48:52 +0000 (11:48 +1000)
committerZefan Li <lizefan@huawei.com>
Mon, 21 Mar 2016 01:17:50 +0000 (09:17 +0800)
commit2411ca5d7a8f95646ba50962d20e06d9aa07a408
tree566b5e03a2f7c57f1a5d861d493c48b1c2a9ceef
parent0444d9dfacb4fa42005ca3afefe56b16f07c5192
md/raid1: extend spinlock to protect raid1_end_read_request against inconsistencies

commit 423f04d63cf421ea436bcc5be02543d549ce4b28 upstream.

raid1_end_read_request() assumes that the In_sync bits are consistent
with the ->degaded count.
raid1_spare_active updates the In_sync bit before the ->degraded count
and so exposes an inconsistency, as does error()
So extend the spinlock in raid1_spare_active() and error() to hide those
inconsistencies.

This should probably be part of
  Commit: 34cab6f42003 ("md/raid1: fix test for 'was read error from
  last working device'.")
as it addresses the same issue.  It fixes the same bug and should go
to -stable for same reasons.

Fixes: 76073054c95b ("md/raid1: clean up read_balance.")
Signed-off-by: NeilBrown <neilb@suse.com>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/md/raid1.c