From 3888f36e36d2a94e5e627259f4a16112b9f34196 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Mon, 16 Sep 2019 17:20:47 +0800 Subject: [PATCH] rq-qos: don't reset has_sleepers on spurious wakeups mainline inclusion from mainline-5.3-rc2 commit 64e7ea875ef63b2801be7954cf7257d1bfccc266 category: bugfix bugzilla: 21211 CVE: NA --------------------------- If we raced with somebody else getting an inflight counter we could fail to get an inflight counter with no sleepers on the list, and thus need to go to sleep. In this case has_sleepers should be true because we are now relying on the waker to get our inflight counter for us. And in the case of spurious wakeups we'd still want this to be the case. So set has_sleepers to true if we went to sleep to make sure we're woken up the proper way. Reviewed-by: Oleg Nesterov Signed-off-by: Josef Bacik Signed-off-by: Jens Axboe Conflicts: block/blk-rq-qos.c [yan: the code was in __wbt_wait()] Signed-off-by: Jason Yan Reviewed-by: Yufen Yu Signed-off-by: Yang Yingliang --- block/blk-wbt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 4a279d27e1c1..4350b373a425 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -569,7 +569,7 @@ static void __wbt_wait(struct rq_wb *rwb, enum wbt_flags wb_acct, } else io_schedule(); - has_sleeper = false; + has_sleeper = true; } while (1); finish_wait(&rqw->wait, &data.wq); -- GitLab