Commit d42e0954 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] md: make sure md always uses rdev_dec_pending properly

The ->nr_pending counted should always be decremented with rdev_dec_pending,
as this need to do things when the count hits zero.  There were a few places
where it was being decremented directly.
Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 69798be8
......@@ -150,7 +150,7 @@ static void unplug_slaves(mddev_t *mddev)
r_queue->unplug_fn(r_queue);
spin_lock_irqsave(&conf->device_lock, flags);
atomic_dec(&rdev->nr_pending);
rdev_dec_pending(rdev, mddev);
}
}
spin_unlock_irqrestore(&conf->device_lock, flags);
......
......@@ -440,7 +440,7 @@ static void unplug_slaves(mddev_t *mddev)
r_queue->unplug_fn(r_queue);
spin_lock_irqsave(&conf->device_lock, flags);
atomic_dec(&rdev->nr_pending);
rdev_dec_pending(rdev, mddev);
}
}
spin_unlock_irqrestore(&conf->device_lock, flags);
......@@ -1086,7 +1086,7 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster)
int rv = max_sector - sector_nr;
md_done_sync(mddev, rv, 1);
put_buf(r1_bio);
atomic_dec(&conf->mirrors[disk].rdev->nr_pending);
rdev_dec_pending(conf->mirrors[disk].rdev, mddev);
return rv;
}
......
......@@ -594,7 +594,7 @@ static void unplug_slaves(mddev_t *mddev)
r_queue->unplug_fn(r_queue);
spin_lock_irqsave(&conf->device_lock, flags);
atomic_dec(&rdev->nr_pending);
rdev_dec_pending(rdev, mddev);
}
}
spin_unlock_irqrestore(&conf->device_lock, flags);
......@@ -1493,7 +1493,7 @@ static int sync_request(mddev_t *mddev, sector_t sector_nr, int go_faster)
for (i=0; i<conf->copies; i++) {
int d = r10_bio->devs[i].devnum;
if (r10_bio->devs[i].bio->bi_end_io)
atomic_dec(&conf->mirrors[d].rdev->nr_pending);
rdev_dec_pending(conf->mirrors[d].rdev, mddev);
}
put_buf(r10_bio);
goto giveup;
......
......@@ -1317,7 +1317,7 @@ static void unplug_slaves(mddev_t *mddev)
r_queue->unplug_fn(r_queue);
spin_lock_irqsave(&conf->device_lock, flags);
atomic_dec(&rdev->nr_pending);
rdev_dec_pending(rdev, mddev);
}
}
spin_unlock_irqrestore(&conf->device_lock, flags);
......
......@@ -1479,7 +1479,7 @@ static void unplug_slaves(mddev_t *mddev)
r_queue->unplug_fn(r_queue);
spin_lock_irqsave(&conf->device_lock, flags);
atomic_dec(&rdev->nr_pending);
rdev_dec_pending(rdev, mddev);
}
}
spin_unlock_irqrestore(&conf->device_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment