Commit 20f6b2c7 authored by Dave Chinner's avatar Dave Chinner Committed by Alex Elder

xfs: check for more work before sleeping in xfssyncd

xfssyncd processes a queue of work by detaching the queue and
then iterating over all the work items. It then sleeps for a
time period or until new work comes in. If new work is queued
while xfssyncd is actively processing the detached work queue,
it will not process that new work until after a sleep timeout
or the next work event queued wakes it.

Fix this by checking the work queue again before going to sleep.
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
parent 69418932
...@@ -607,7 +607,8 @@ xfssyncd( ...@@ -607,7 +607,8 @@ xfssyncd(
set_freezable(); set_freezable();
timeleft = xfs_syncd_centisecs * msecs_to_jiffies(10); timeleft = xfs_syncd_centisecs * msecs_to_jiffies(10);
for (;;) { for (;;) {
timeleft = schedule_timeout_interruptible(timeleft); if (list_empty(&mp->m_sync_list))
timeleft = schedule_timeout_interruptible(timeleft);
/* swsusp */ /* swsusp */
try_to_freeze(); try_to_freeze();
if (kthread_should_stop() && list_empty(&mp->m_sync_list)) if (kthread_should_stop() && list_empty(&mp->m_sync_list))
...@@ -627,8 +628,7 @@ xfssyncd( ...@@ -627,8 +628,7 @@ xfssyncd(
list_add_tail(&mp->m_sync_work.w_list, list_add_tail(&mp->m_sync_work.w_list,
&mp->m_sync_list); &mp->m_sync_list);
} }
list_for_each_entry_safe(work, n, &mp->m_sync_list, w_list) list_splice_init(&mp->m_sync_list, &tmp);
list_move(&work->w_list, &tmp);
spin_unlock(&mp->m_sync_lock); spin_unlock(&mp->m_sync_lock);
list_for_each_entry_safe(work, n, &tmp, w_list) { list_for_each_entry_safe(work, n, &tmp, w_list) {
......
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