summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-19 08:27:13 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-19 08:27:13 -0700
commit3e4b9459fb0e149c6b74c9e89399a8fc39a92b44 (patch)
tree1fb7c9bee029c0349f4e2071fcdfc10fbbcd0d00 /drivers/md/raid1.c
parent309d4b000b0c427dafece9111682dd15fbaae6a6 (diff)
parent58e94ae18478c08229626daece2fc108a4a23261 (diff)
Merge tag 'md-3.5-fixes' of git://neil.brown.name/md
Pull three md bugfixes from NeilBrown: "One of the bugs was introduced in 3.5-rc1. Others have been there for longer." * tag 'md-3.5-fixes' of git://neil.brown.name/md: md/raid1: close some possible races on write errors during resync md: avoid crash when stopping md array races with closing other open fds. md: fix bug in handling of new_data_offset
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 240ff312504..cacd008d686 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1818,8 +1818,14 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)
if (atomic_dec_and_test(&r1_bio->remaining)) {
/* if we're here, all write(s) have completed, so clean up */
- md_done_sync(mddev, r1_bio->sectors, 1);
- put_buf(r1_bio);
+ int s = r1_bio->sectors;
+ if (test_bit(R1BIO_MadeGood, &r1_bio->state) ||
+ test_bit(R1BIO_WriteError, &r1_bio->state))
+ reschedule_retry(r1_bio);
+ else {
+ put_buf(r1_bio);
+ md_done_sync(mddev, s, 1);
+ }
}
}