mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
netfs: release readahead folios on iterator preparation failure
[ Upstream commit87eb3d272d] netfs_prepare_read_iterator() batches readahead folios in put_batch so that the folio references can be dropped after the I/O iterator has been prepared. If rolling_buffer_load_from_ra() fails after earlier folios have been batched, the function returns immediately and leaves those references held. Release the batch before returning the error. Fixes:06fa229ceb("netfs: Abstract out a rolling folio buffer implementation") Signed-off-by: Yichong Chen <chenyichong@uniontech.com> Signed-off-by: David Howells <dhowells@redhat.com> Link: https://patch.msgid.link/20260727130716.1099906-4-dhowells@redhat.com cc: Paulo Alcantara <pc@manguebit.org> cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
291ebecdf3
commit
2c148a31ca
@@ -102,8 +102,10 @@ static ssize_t netfs_prepare_read_iterator(struct netfs_io_subrequest *subreq,
|
||||
|
||||
added = rolling_buffer_load_from_ra(&rreq->buffer, ractl,
|
||||
&put_batch);
|
||||
if (added < 0)
|
||||
if (added < 0) {
|
||||
folio_batch_release(&put_batch);
|
||||
return added;
|
||||
}
|
||||
rreq->submitted += added;
|
||||
}
|
||||
folio_batch_release(&put_batch);
|
||||
|
||||
Reference in New Issue
Block a user