Commit 9eb0a380 authored by Yu Kuai's avatar Yu Kuai Committed by openeuler-sync-bot
Browse files

md/bitmap: always wake up md_thread in timeout_store

mainline inclusion
from mainline-v6.5-rc1
commit c333673a
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8OPEK
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c333673a78307abe6b1f6998809288fcd86740ed



--------------------------------

md_wakeup_thread() can handle the case that pass in md_thread is NULL,
the only difference is that md_wakeup_thread() will be called when
current timeout is 'MAX_SCHEDULE_TIMEOUT', this should not matter
because timeout_store() is not hot path, and the daemon process is
woke up more than demand from other context already.

Prepare to factor out a helper to set timeout.

Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Signed-off-by: default avatarSong Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20230523021017.3048783-4-yukuai1@huaweicloud.com


Signed-off-by: default avatarLi Lingfeng <lilingfeng3@huawei.com>
(cherry picked from commit 3298644f)
parent a9ade078
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2456,11 +2456,11 @@ timeout_store(struct mddev *mddev, const char *buf, size_t len)
		 * the bitmap is all clean and we don't need to
		 * adjust the timeout right now
		 */
		if (mddev->thread->timeout < MAX_SCHEDULE_TIMEOUT) {
		if (mddev->thread->timeout < MAX_SCHEDULE_TIMEOUT)
			mddev->thread->timeout = timeout;
			md_wakeup_thread(mddev->thread);
		}
	}

	md_wakeup_thread(mddev->thread);
	return len;
}