* [PATCH 0/1] Fix raid1 resync getting stuck
@ 2015-09-16 14:20 Jes.Sorensen
2015-09-16 14:20 ` [PATCH 1/1] md/raid1: Avoid " Jes.Sorensen
0 siblings, 1 reply; 3+ messages in thread
From: Jes.Sorensen @ 2015-09-16 14:20 UTC (permalink / raw)
To: neilb; +Cc: linux-raid, nate.dailey
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Neil,
This patch seems to do the job for us. Nate ran testing with > 500
iterations which would normally fail in less than 10.
I tried changing MaxSector to ((~(sector_t)0) >> 1) as you suggested,
but that made the raid5 code go explosive. This on the other hand
seems to do the trick.
Cheers,
Jes
Jes Sorensen (1):
md/raid1: Avoid raid1 resync getting stuck
drivers/md/raid1.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--
2.4.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] md/raid1: Avoid raid1 resync getting stuck
2015-09-16 14:20 [PATCH 0/1] Fix raid1 resync getting stuck Jes.Sorensen
@ 2015-09-16 14:20 ` Jes.Sorensen
2015-09-23 6:49 ` Neil Brown
0 siblings, 1 reply; 3+ messages in thread
From: Jes.Sorensen @ 2015-09-16 14:20 UTC (permalink / raw)
To: neilb; +Cc: linux-raid, nate.dailey
From: Jes Sorensen <Jes.Sorensen@redhat.com>
close_sync() needs to set conf->next_resync to a large, but safe value
below MaxSector and use it to determine whether or not to set
start_next_window in wait_barrier()
Solution suggested by Neil Brown.
Reported-by: Nate Dailey <nate.dailey@stratus.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
drivers/md/raid1.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 4517f06..763a0a8 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -881,8 +881,7 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio)
}
if (bio && bio_data_dir(bio) == WRITE) {
- if (bio->bi_iter.bi_sector >=
- conf->mddev->curr_resync_completed) {
+ if (bio->bi_iter.bi_sector >= conf->next_resync) {
if (conf->start_next_window == MaxSector)
conf->start_next_window =
conf->next_resync +
@@ -1516,7 +1515,7 @@ static void close_sync(struct r1conf *conf)
conf->r1buf_pool = NULL;
spin_lock_irq(&conf->resync_lock);
- conf->next_resync = 0;
+ conf->next_resync = MaxSector - 2 * NEXT_NORMALIO_DISTANCE;
conf->start_next_window = MaxSector;
conf->current_window_requests +=
conf->next_window_requests;
--
2.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] md/raid1: Avoid raid1 resync getting stuck
2015-09-16 14:20 ` [PATCH 1/1] md/raid1: Avoid " Jes.Sorensen
@ 2015-09-23 6:49 ` Neil Brown
0 siblings, 0 replies; 3+ messages in thread
From: Neil Brown @ 2015-09-23 6:49 UTC (permalink / raw)
To: Jes.Sorensen; +Cc: linux-raid, nate.dailey
[-- Attachment #1: Type: text/plain, Size: 1457 bytes --]
Jes.Sorensen@redhat.com writes:
> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>
> close_sync() needs to set conf->next_resync to a large, but safe value
> below MaxSector and use it to determine whether or not to set
> start_next_window in wait_barrier()
>
> Solution suggested by Neil Brown.
>
> Reported-by: Nate Dailey <nate.dailey@stratus.com>
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> ---
> drivers/md/raid1.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 4517f06..763a0a8 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -881,8 +881,7 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio)
> }
>
> if (bio && bio_data_dir(bio) == WRITE) {
> - if (bio->bi_iter.bi_sector >=
> - conf->mddev->curr_resync_completed) {
> + if (bio->bi_iter.bi_sector >= conf->next_resync) {
> if (conf->start_next_window == MaxSector)
> conf->start_next_window =
> conf->next_resync +
> @@ -1516,7 +1515,7 @@ static void close_sync(struct r1conf *conf)
> conf->r1buf_pool = NULL;
>
> spin_lock_irq(&conf->resync_lock);
> - conf->next_resync = 0;
> + conf->next_resync = MaxSector - 2 * NEXT_NORMALIO_DISTANCE;
> conf->start_next_window = MaxSector;
> conf->current_window_requests +=
> conf->next_window_requests;
> --
> 2.4.3
Applied, thanks.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-23 6:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16 14:20 [PATCH 0/1] Fix raid1 resync getting stuck Jes.Sorensen
2015-09-16 14:20 ` [PATCH 1/1] md/raid1: Avoid " Jes.Sorensen
2015-09-23 6:49 ` Neil Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).