]> git.baikalelectronics.ru Git - kernel.git/commit
Revert "gfs2: stop using generic_writepages in gfs2_ail1_start_one"
authorAndreas Gruenbacher <agruenba@redhat.com>
Thu, 19 Jan 2023 19:14:42 +0000 (20:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:13 +0000 (11:28 +0100)
commitfddeb232cbb045ccc64639162c62e47fe5158a4b
treed122a3e8e3cb69e79a9afdceab6d2a141ef3b19e
parent84d10393dc71138ce4727c0a696eb4cc3ac168d8
Revert "gfs2: stop using generic_writepages in gfs2_ail1_start_one"

[ Upstream commit 95ecbd0f162fc06ef4c4045a66f653f47b62a2d3 ]

Commit c684351eef43 switched from generic_writepages() to
filemap_fdatawrite_wbc() in gfs2_ail1_start_one() on the path to
replacing ->writepage() with ->writepages() and eventually eliminating
the former.  Function gfs2_ail1_start_one() is called from
gfs2_log_flush(), our main function for flushing the filesystem log.

Unfortunately, at least as implemented today, ->writepage() and
->writepages() are entirely different operations for journaled data
inodes: while the former creates and submits transactions covering the
data to be written, the latter flushes dirty buffers out to disk.

With gfs2_ail1_start_one() now calling ->writepages(), we end up
creating filesystem transactions while we are in the course of a log
flush, which immediately deadlocks on the sdp->sd_log_flush_lock
semaphore.

Work around that by going back to how things used to work before commit
c684351eef43 for now; figuring out a superior solution will take time we
don't have available right now.  However ...

Since the removal of generic_writepages() is imminent, open-code it
here.  We're already inside a blk_start_plug() ...  blk_finish_plug()
section here, so skip that part of the original generic_writepages().

This reverts commit c684351eef436b8753bd10eb1adffa65350c8097.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/gfs2/log.c