提交 bbe4d31d 编写于 作者: D Dave Chinner 提交者: Zheng Zengkai

xfs: remove callback dequeue loop from xlog_state_do_iclog_callbacks

mainline-inclusion
from mainline-v5.13-rc4
commit b6903358
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4KIAO
CVE: NA

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

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

If we are processing callbacks on an iclog, nothing can be
concurrently adding callbacks to the loop. We only add callbacks to
the iclog when they are in ACTIVE or WANT_SYNC state, and we
explicitly do not add callbacks if the iclog is already in IOERROR
state.

The only way to have a dequeue racing with an enqueue is to be
processing a shutdown without a direct reference to an iclog in
ACTIVE or WANT_SYNC state. As the enqueue avoids this race
condition, we only ever need a single dequeue operation in
xlog_state_do_iclog_callbacks(). Hence we can remove the loop.
Signed-off-by: NDave Chinner <dchinner@redhat.com>
Reviewed-by: NBrian Foster <bfoster@redhat.com>
Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
Signed-off-by: NDarrick J. Wong <djwong@kernel.org>
Signed-off-by: NGuo Xuenan <guoxuenan@huawei.com>
Reviewed-by: NLihong Kou <koulihong@huawei.com>
Reviewed-by: NZhang Yi <yi.zhang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 8f6c2af2
...@@ -2688,19 +2688,13 @@ xlog_state_do_iclog_callbacks( ...@@ -2688,19 +2688,13 @@ xlog_state_do_iclog_callbacks(
struct xlog *log, struct xlog *log,
struct xlog_in_core *iclog) struct xlog_in_core *iclog)
{ {
spin_lock(&iclog->ic_callback_lock);
while (!list_empty(&iclog->ic_callbacks)) {
LIST_HEAD(tmp); LIST_HEAD(tmp);
spin_lock(&iclog->ic_callback_lock);
list_splice_init(&iclog->ic_callbacks, &tmp); list_splice_init(&iclog->ic_callbacks, &tmp);
spin_unlock(&iclog->ic_callback_lock); spin_unlock(&iclog->ic_callback_lock);
xlog_cil_process_committed(&tmp); xlog_cil_process_committed(&tmp);
spin_lock(&iclog->ic_callback_lock);
}
spin_unlock(&iclog->ic_callback_lock);
} }
STATIC void STATIC void
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册