diff options
author | Bob Peterson <rpeterso@redhat.com> | 2017-01-06 22:14:28 -0500 |
---|---|---|
committer | Bob Peterson <rpeterso@redhat.com> | 2017-01-06 22:14:28 -0500 |
commit | b63f5e84826b3e1ae81e051a6a7c5a94b657aecb (patch) | |
tree | 1175b1dc2e02d148dbee7e1c941b15aadffb2982 | |
parent | f07b352021483a3a38f081dc284928400a9c1d2c (diff) | |
download | blackbird-op-linux-b63f5e84826b3e1ae81e051a6a7c5a94b657aecb.tar.gz blackbird-op-linux-b63f5e84826b3e1ae81e051a6a7c5a94b657aecb.zip |
GFS2: Wake up io waiters whenever a flush is done
Before this patch, if a process called function gfs2_log_reserve to
reserve some journal blocks, but the journal not enough blocks were
free, it would call io_schedule. However, in the log flush daemon,
it woke up the waiters only if an gfs2_ail_flush was no longer
required. This resulted in situations where processes would wait
forever because the number of blocks required was so high that it
pushed the journal into a perpetual state of flush being required.
This patch changes the logd daemon so that it wakes up io waiters
every time the log is actually flushed.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
-rw-r--r-- | fs/gfs2/log.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 4df349c7f022..5028a9d00c17 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -918,12 +918,15 @@ int gfs2_logd(void *data) struct gfs2_sbd *sdp = data; unsigned long t = 1; DEFINE_WAIT(wait); + bool did_flush; while (!kthread_should_stop()) { + did_flush = false; if (gfs2_jrnl_flush_reqd(sdp) || t == 0) { gfs2_ail1_empty(sdp); gfs2_log_flush(sdp, NULL, NORMAL_FLUSH); + did_flush = true; } if (gfs2_ail_flush_reqd(sdp)) { @@ -931,9 +934,10 @@ int gfs2_logd(void *data) gfs2_ail1_wait(sdp); gfs2_ail1_empty(sdp); gfs2_log_flush(sdp, NULL, NORMAL_FLUSH); + did_flush = true; } - if (!gfs2_ail_flush_reqd(sdp)) + if (!gfs2_ail_flush_reqd(sdp) || did_flush) wake_up(&sdp->sd_log_waitq); t = gfs2_tune_get(sdp, gt_logd_secs) * HZ; |