Commit 0de57e54 authored by Yu Kuai's avatar Yu Kuai Committed by Song Liu

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: default avatarYu Kuai <yukuai3@huawei.com>
Reviewed-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Acked-by: default avatarGuoqing Jiang <guoqing.jiang@linux.dev>
Signed-off-by: default avatarSong Liu <song@kernel.org>
parent ed2e063f
...@@ -990,17 +990,17 @@ static bool wait_barrier(struct r10conf *conf, bool nowait) ...@@ -990,17 +990,17 @@ static bool wait_barrier(struct r10conf *conf, bool nowait)
spin_lock_irq(&conf->resync_lock); spin_lock_irq(&conf->resync_lock);
if (conf->barrier) { if (conf->barrier) {
conf->nr_waiting++;
/* Return false when nowait flag is set */ /* Return false when nowait flag is set */
if (nowait) { if (nowait) {
ret = false; ret = false;
} else { } else {
conf->nr_waiting++;
raid10_log(conf->mddev, "wait barrier"); raid10_log(conf->mddev, "wait barrier");
wait_event_lock_irq(conf->wait_barrier, wait_event_lock_irq(conf->wait_barrier,
stop_waiting_barrier(conf), stop_waiting_barrier(conf),
conf->resync_lock); conf->resync_lock);
conf->nr_waiting--;
} }
conf->nr_waiting--;
if (!conf->nr_waiting) if (!conf->nr_waiting)
wake_up(&conf->wait_barrier); wake_up(&conf->wait_barrier);
} }
......
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