summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2022-09-16 19:34:25 +0800
committerSong Liu <song@kernel.org>2022-09-22 00:05:05 -0700
commit0de57e541bb4207c0602eca271c6531c305e9c5d (patch)
tree7e1e67218e687723d2b6d19836ee0b00152dcc7c /drivers
parented2e063f92c44c891ccd883e289dde6ca870edcc (diff)
md/raid10: don't modify 'nr_waitng' in wait_barrier() for the case nowait
For the case nowait in wait_barrier(), there is no point to increase nr_waiting and then decrease it. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Logan Gunthorpe <logang@deltatee.com> Acked-by: Guoqing Jiang <guoqing.jiang@linux.dev> Signed-off-by: Song Liu <song@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/raid10.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 310a6132304f..834a34274976 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -990,17 +990,17 @@ static bool wait_barrier(struct r10conf *conf, bool nowait)
spin_lock_irq(&conf->resync_lock);
if (conf->barrier) {
- conf->nr_waiting++;
/* Return false when nowait flag is set */
if (nowait) {
ret = false;
} else {
+ conf->nr_waiting++;
raid10_log(conf->mddev, "wait barrier");
wait_event_lock_irq(conf->wait_barrier,
stop_waiting_barrier(conf),
conf->resync_lock);
+ conf->nr_waiting--;
}
- conf->nr_waiting--;
if (!conf->nr_waiting)
wake_up(&conf->wait_barrier);
}