Skip to content

Commit

Permalink
md/raid10: don't modify 'nr_waitng' in wait_barrier() for the case no…
Browse files Browse the repository at this point in the history
…wait

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>
  • Loading branch information
Yu Kuai authored and Song Liu committed Sep 22, 2022
1 parent ed2e063 commit 0de57e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 0de57e5

Please sign in to comment.