dm raid1: fix error count

Always increase the error count when I/O on a leg of a mirror fails.

The error count is used to decide whether to select an alternative
mirror leg. If the target doesn't use the "handle_errors" feature, the
error count is not updated and the bio can get requeued forever by the
read callback.

Fix it by increasing error_count before the handle_errors feature
checking.

Cc: stable@kernel.org
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>

authored by

Jonathan Brassow and committed by
Alasdair G Kergon
d460c65a c7a2bd19

+3 -3
+3 -3
drivers/md/dm-raid1.c
··· 197 struct mirror_set *ms = m->ms; 198 struct mirror *new; 199 200 - if (!errors_handled(ms)) 201 - return; 202 - 203 /* 204 * error_count is used for nothing more than a 205 * simple way to tell if a device has encountered ··· 205 atomic_inc(&m->error_count); 206 207 if (test_and_set_bit(error_type, &m->error_type)) 208 return; 209 210 if (m != get_default_mirror(ms))
··· 197 struct mirror_set *ms = m->ms; 198 struct mirror *new; 199 200 /* 201 * error_count is used for nothing more than a 202 * simple way to tell if a device has encountered ··· 208 atomic_inc(&m->error_count); 209 210 if (test_and_set_bit(error_type, &m->error_type)) 211 + return; 212 + 213 + if (!errors_handled(ms)) 214 return; 215 216 if (m != get_default_mirror(ms))