From nobody Tue Apr 7 17:16:30 2026 Received: from r3-25.sinamail.sina.com.cn (r3-25.sinamail.sina.com.cn [202.108.3.25]) (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 CD8CA1EBA19 for ; Fri, 27 Feb 2026 02:30:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.108.3.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772159437; cv=none; b=JnzTEMh4fIYGAl51XxKs6d0gwEAHl5zxZWmanRNOEZiwGy9ixJly3GIu7Qal5q5yL2+IezxqP622J0sWLHWXnBkDOQjtuv2aveHJGjoOuu9lD6Ssxdg+9VQhTLUqZrkuSAEeFtv1YBfdDDjBI2oz3BQy7KLTkuGb2Ao5pDwaTX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772159437; c=relaxed/simple; bh=pEmKleDY+xmVurgThOodYohvDtSLa4qaGmc+F93ltn0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=rJVP3OUcY++WfhlVaiR/7M8+F9/BvNfPQmi0NgZpt0gmB1/a+VdHmBfgiuCDIq0GfVTGdrtjbCNOya384Ji52ZCsljkQIK5ah5+ZjBjycbkN2ys4EeTM6o5QmzEvol1VFfuRlJ0tWtLZpmlFCP0eY5yLdcsEa2uJydqZm7UnkhU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; dkim=pass (1024-bit key) header.d=sina.com header.i=@sina.com header.b=hUA2pcuH; arc=none smtp.client-ip=202.108.3.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sina.com header.i=@sina.com header.b="hUA2pcuH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sina.com; s=201208; t=1772159434; bh=Ex9qM+2XuVg2r2DvaSUmdorI2HFF8ZSJSdl1UB3maXw=; h=From:Subject:Date:Message-ID; b=hUA2pcuHbSQO1WcSpWpgM/fzSqqnYq4dWCWdjzzF++O2sJ7lNGsNL909nbsVfIUJL 2rOLMfqkGta83DSbpYwsxJq1iKxyCR+Y7Ue+LKJRJhDLv52E7/4pXy6nHpJ0skFrRn 5A+LH0vN5KeYUOybf3ZxdevodGCuc3ol4OTB7b4g= X-SMAIL-HELO: PC.mioffice.cn Received: from unknown (HELO PC.mioffice.cn)([114.247.175.198]) by sina.com (10.54.253.31) with ESMTP id 69A101BD000067A8; Fri, 27 Feb 2026 10:30:23 +0800 (CST) X-Sender: shengyong2026@sina.com X-Auth-ID: shengyong2026@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=shengyong2026@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=shengyong2026@sina.com X-SMAIL-MID: 5900266816028 X-SMAIL-UIID: 2A7E148782974AE49E6D5F2827846A8B-20260227-103023-1 From: Sheng Yong To: xiang@kernel.org Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, Sheng Yong , chenguanyou , Yunlei He Subject: [PATCH v2] erofs: set fileio bio failed in short read case Date: Fri, 27 Feb 2026 10:30:08 +0800 Message-ID: <20260227023008.147813-1-shengyong2026@sina.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Sheng Yong 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 <=3D detect signal erofs_fileio_ki_complete <=3D 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-bac= ked mounts") Reported-by: chenguanyou Signed-off-by: Yunlei He Signed-off-by: Sheng Yong Reviewed-by: Chao Yu Reviewed-by: Gao Xiang --- 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 abe873f01297..98cdaa1cd1a7 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; =20 - if (ret >=3D 0 && ret !=3D rq->bio.bi_iter.bi_size) { - bio_advance(&rq->bio, ret); - zero_fill_bio(&rq->bio); - } + if (ret >=3D 0 && ret !=3D rq->bio.bi_iter.bi_size) + ret =3D -EIO; if (!rq->bio.bi_end_io) { bio_for_each_folio_all(fi, &rq->bio) { DBG_BUGON(folio_test_uptodate(fi.folio)); --=20 2.43.0