gfs2: Don't use filemap_splice_read
authorBob Peterson <rpeterso@redhat.com>
Wed, 2 Aug 2023 14:24:12 +0000 (09:24 -0500)
committerAndreas Gruenbacher <agruenba@redhat.com>
Mon, 7 Aug 2023 16:42:04 +0000 (18:42 +0200)
commit0be8432166a61abc537e1247e530f4b85970b56b
tree3859cf0b9491e7fdcc43ba75e6f628df15a104a2
parent2cbd80642b76480c9b0697297af917d9388a0b46
gfs2: Don't use filemap_splice_read

Starting with patch 2cb1e08985, gfs2 started using the new function
filemap_splice_read rather than the old (and subsequently deleted)
function generic_file_splice_read.

filemap_splice_read works by taking references to a number of folios in
the page cache and splicing those folios into a pipe.  The folios are
then read from the pipe and the folio references are dropped.  This can
take an arbitrary amount of time.  We cannot allow that in gfs2 because
those folio references will pin the inode glock to the node and prevent
it from being demoted, which can lead to cluster-wide deadlocks.

Instead, use copy_splice_read.

(In addition, the old generic_file_splice_read called into ->read_iter,
which called gfs2_file_read_iter, which took the inode glock during the
operation.  The new filemap_splice_read interface does not take the
inode glock anymore.  This is fixable, but it still wouldn't prevent
cluster-wide deadlocks.)

Fixes: 2cb1e08985e3 ("splice: Use filemap_splice_read() instead of generic_file_splice_read()")
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/file.c