gfs2: Inode dirtying fix
authorAndreas Gruenbacher <agruenba@redhat.com>
Sat, 27 Jul 2019 15:12:54 +0000 (17:12 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 31 Jul 2019 16:51:50 +0000 (18:51 +0200)
commit706cb5492c8c459199fa0ab3b5fd2ba54ee53b0c
treef3d0e8df11ecdec00a54b6c96f5a433995a1ae02
parent609488bc979f99f805f34e9a32c1e3b71179d10b
gfs2: Inode dirtying fix

With the recent iomap write page reclaim deadlock fix, it turns out that the
GLF_DIRTY flag isn't always set when it needs to be anymore: previously, this
happened as a side effect of always adding the inode buffer head to the current
transaction with gfs2_trans_add_meta, but this isn't happening consistently
anymore.  Fix by removing an additional unnecessary gfs2_trans_add_meta call
and by setting the GLF_DIRTY flag in gfs2_iomap_end.

(The GLF_DIRTY flag causes inode_go_sync to flush the transaction log when
syncing out the glock of that inode.  When the flag isn't set, inode_go_sync
will skip inodes, including ones with an i_state of I_DIRTY_PAGES, which will
lead to cluster incoherency.)

In addition, in gfs2_iomap_page_done, if the metadata has changed, mark the
inode as I_DIRTY_DATASYNC to have the inode added to the current transaction:
we don't expect metadata to change here, but let's err on the safe side.

Fixes: d0a22a4b03b8 ("gfs2: Fix iomap write page reclaim deadlock");
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/bmap.c