Skip to content

Commit

Permalink
md/raid10: decrement correct pending counter when writing to replacem…
Browse files Browse the repository at this point in the history
…ent.

When a write to a replacement device completes, we carefully
and correctly found the rdev that the write actually went to
and the blithely called rdev_dec_pending on the primary rdev,
even if this write was to the replacement.

This means that any writes to an array while a replacement
was ongoing would cause the nr_pending count for the primary
device to go negative, so it could never be removed.

This bug has been present since replacement was introduced in
3.3, so it is suitable for any -stable kernel since then.

Reported-by: "George Spelvin" <[email protected]>
Cc: [email protected]
Signed-off-by: NeilBrown <[email protected]>
  • Loading branch information
neilbrown committed Nov 22, 2012
1 parent e7c0c3f commit 884162d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ static void raid10_end_write_request(struct bio *bio, int error)
*/
one_write_done(r10_bio);
if (dec_rdev)
rdev_dec_pending(conf->mirrors[dev].rdev, conf->mddev);
rdev_dec_pending(rdev, conf->mddev);
}

/*
Expand Down

0 comments on commit 884162d

Please sign in to comment.