]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
GFS2: flush the log and all pages for jdata as we do for WB_SYNC_ALL
authorBob Peterson <rpeterso@redhat.com>
Wed, 11 Oct 2017 14:22:07 +0000 (16:22 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 31 Oct 2017 13:26:35 +0000 (14:26 +0100)
In function gfs2_write_inode, starting with patch a9185b41a4f84, we
only flush the log and call filemap_fdatawait if we're passed in a
wbc sync_mode of WB_SYNC_ALL. We also need to do these things if
we're evicting a jdata inode, because we might have jdata pages
still attached to bufdata descriptors that need to be revoked, but
by the time it gets to evict() it's too late to start a new
transaction. This patch changes it to treat jdata inodes as if
WB_SYNC_ALL had been specified.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Acked-by: Abhijith Das <adas@redhat.com>
fs/gfs2/super.c

index 8e54f2e3a3040e19052a14cfd593644f3309c1e0..9cb5c9a97d69d04cf564ca69e48bfd15f701ea7c 100644 (file)
@@ -754,14 +754,15 @@ static int gfs2_write_inode(struct inode *inode, struct writeback_control *wbc)
        struct address_space *metamapping = gfs2_glock2aspace(ip->i_gl);
        struct backing_dev_info *bdi = inode_to_bdi(metamapping->host);
        int ret = 0;
+       bool flush_all = (wbc->sync_mode == WB_SYNC_ALL || gfs2_is_jdata(ip));
 
-       if (wbc->sync_mode == WB_SYNC_ALL)
+       if (flush_all)
                gfs2_log_flush(GFS2_SB(inode), ip->i_gl, NORMAL_FLUSH);
        if (bdi->wb.dirty_exceeded)
                gfs2_ail1_flush(sdp, wbc);
        else
                filemap_fdatawrite(metamapping);
-       if (wbc->sync_mode == WB_SYNC_ALL)
+       if (flush_all)
                ret = filemap_fdatawait(metamapping);
        if (ret)
                mark_inode_dirty_sync(inode);