Commit d460c65a6a9ec9e0d284864ec3a9a2d1b73f0e43

Authored by Jonathan Brassow
Committed by Alasdair G Kergon
1 parent c7a2bd19b7

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>

Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff

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