From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8767B425CC6; Tue, 31 Mar 2026 16:35:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774974953; cv=none; b=YyNrOBVvdxJaikK31jRBKTBb7NfMoQirHwFK7GiZTucx+zCpjOi/0W+yyr6tzuwUhX2+MikTzxd0p4B6Zmy68GG3/J0xPsLOK7CLAkkKK4aLJjoA2t6H4YsJWUJ8vHhFIzNGgLCpyLw7oBfyRgRbEx8pTEbegH/g5mEKQq5O9EE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774974953; c=relaxed/simple; bh=3Cuj2mNxv2WSj7tr94O2WHccRHgUbvSK0mNKGndP+/w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Asqx5tEp7Xh4C/+NRk9HXhPK6q7XFitq/u514mvVVPwpVZ1oxQisSqfEwSjqwuGBoE1tvcgWQMHqgKpAk6SEsq1WxFObFHvCEF1H+HLYljxm73Hsrf4YuIcPjYuQGqeBqIQqhRv4TXYs/z409VeHel4/U9yetJO6MYdmHladcqs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Xi9wgebe; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Xi9wgebe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D177C19423; Tue, 31 Mar 2026 16:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774974953; bh=3Cuj2mNxv2WSj7tr94O2WHccRHgUbvSK0mNKGndP+/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xi9wgebeAHUeIPrStarKhI1grH5zikgK2/X415Gumw6hrC/PyU6DUCLTvayx/TYuz SUIgMZnX5V8IwkVLgN36c3B0Wb7HEHfHlGS9ATVoQgo54tpqttPXh9gbYhLzTY+eEG aKpntV3o9KIuq5/k35DIyx2oc7WQ1pyYxYtvO8is= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, chenguanyou , Yunlei He , Sheng Yong , Gao Xiang , Chao Yu , Sasha Levin Subject: [PATCH 6.19 090/342] erofs: set fileio bio failed in short read case Date: Tue, 31 Mar 2026 18:18:43 +0200 Message-ID: <20260331161802.332690080@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260331161758.909578033@linuxfoundation.org> References: <20260331161758.909578033@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sheng Yong [ Upstream commit eade54040384f54b7fb330e4b0975c5734850b3c ] For file-backed mount, IO requests are handled by vfs_iocb_iter_read(). However, it can be interrupted by SIGKILL, returning the number of bytes actually copied. Unused folios in bio are unexpectedly marked as uptodate. vfs_read filemap_read filemap_get_pages filemap_readahead erofs_fileio_readahead erofs_fileio_rq_submit vfs_iocb_iter_read filemap_read filemap_get_pages <= detect signal erofs_fileio_ki_complete <= set all folios uptodate This patch addresses this by setting short read bio with an error directly. Fixes: bc804a8d7e86 ("erofs: handle end of filesystem properly for file-backed mounts") Reported-by: chenguanyou Signed-off-by: Yunlei He Signed-off-by: Sheng Yong Reviewed-by: Gao Xiang Reviewed-by: Chao Yu Signed-off-by: Gao Xiang Signed-off-by: Sasha Levin --- fs/erofs/fileio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/erofs/fileio.c b/fs/erofs/fileio.c index 2a778a02681a0..aa580c59fe645 100644 --- a/fs/erofs/fileio.c +++ b/fs/erofs/fileio.c @@ -25,10 +25,8 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, long ret) container_of(iocb, struct erofs_fileio_rq, iocb); struct folio_iter fi; - if (ret >= 0 && ret != rq->bio.bi_iter.bi_size) { - bio_advance(&rq->bio, ret); - zero_fill_bio(&rq->bio); - } + if (ret >= 0 && ret != rq->bio.bi_iter.bi_size) + ret = -EIO; if (!rq->bio.bi_end_io) { bio_for_each_folio_all(fi, &rq->bio) { DBG_BUGON(folio_test_uptodate(fi.folio)); -- 2.51.0