diff options
author | Abhi Das <adas@redhat.com> | 2017-08-04 19:15:32 +0200 |
---|---|---|
committer | Bob Peterson <rpeterso@redhat.com> | 2017-08-10 17:51:03 +0200 |
commit | b066a4eebd4f5ea77f7e5c7d13104d38e1a1d4bf (patch) | |
tree | b8f53940b11052f2cb444f21586063eed0c1f3e5 /fs/gfs2/log.c | |
parent | gfs2: Clean up waiting on glocks (diff) | |
download | linux-b066a4eebd4f5ea77f7e5c7d13104d38e1a1d4bf.tar.xz linux-b066a4eebd4f5ea77f7e5c7d13104d38e1a1d4bf.zip |
gfs2: forcibly flush ail to relieve memory pressure
On systems with low memory, it is possible for gfs2 to infinitely
loop in balance_dirty_pages() under heavy IO (creating sparse files).
balance_dirty_pages() attempts to write out the dirty pages via
gfs2_writepages() but none are found because these dirty pages are
being used by the journaling code in the ail. Normally, the journal
has an upper threshold which when hit triggers an automatic flush
of the ail. But this threshold can be higher than the number of
allowable dirty pages and result in the ail never being flushed.
This patch forces an ail flush when gfs2_writepages() fails to write
anything. This is a good indication that the ail might be holding
some dirty pages.
Signed-off-by: Abhi Das <adas@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/log.c')
-rw-r--r-- | fs/gfs2/log.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 9a624f694400..31585c2d22fe 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c @@ -898,6 +898,10 @@ static inline int gfs2_jrnl_flush_reqd(struct gfs2_sbd *sdp) static inline int gfs2_ail_flush_reqd(struct gfs2_sbd *sdp) { unsigned int used_blocks = sdp->sd_jdesc->jd_blocks - atomic_read(&sdp->sd_log_blks_free); + + if (test_and_clear_bit(SDF_FORCE_AIL_FLUSH, &sdp->sd_flags)) + return 1; + return used_blocks + atomic_read(&sdp->sd_log_blks_needed) >= atomic_read(&sdp->sd_log_thresh2); } |