From nobody Sun Feb 8 00:34:36 2026 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) (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 838ED2DCF46 for ; Fri, 30 Jan 2026 07:34:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769758471; cv=none; b=fT1CMJ9dEh8DKJhl4Qilwd6yPuIPMDFgeeS3nWtyZ+FDsjt+TP6VukXVAexCMNrEs0y5H7fDexmYBFuIHtTH9NlEtxWerT1FYX1wRSUtMXy0cgYBefgkJCjWfVPhFKikgWqOcE3Bhll1AP7RPUxKN7opmsR4RUKtiLLTaKTjBfU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769758471; c=relaxed/simple; bh=Pb0kmPGe9yKPnIRe+8eTLEL93e9HtHW+/XxP5L9wE6M=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=UaQLw1PjQByK+Ikna1cUGc3YjwU7vtXO+iFRKh3MtKlAxJrzoexHEVt86K1SW2dIGrORPwxoifRlZJLW8rnTD33E81OousL6rqF5ok7W/nZMRV0FCCHLayXrVx2mQmxMJZJUSt7TIwzSnHPHuOESz4EY3BzCwXq1AX8Q/O4XI/A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=K18MWI+s; arc=none smtp.client-ip=115.124.30.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="K18MWI+s" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1769758467; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=SdbkKy445/WU0XjKKXOeP0qB9ekgbi8ai7BayKxssio=; b=K18MWI+sNWUbUJ3id83cprRz8l2xSnRNciID3rwfBTGgpIo7Bxf8VpLNOqLGDTiie8+fInnIkb9pujr6MRkcwMuRlBo4cpEpGjqkIH+CXJRBkQo8/0562ayOmoO0Aft26wXl7BdcBQUJbCUTaUELk6j6fj8vXlUoSHBGQhNoH3k= Received: from x31i01179.sqa.na131.tbsite.net(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0WyA.pOL_1769758462 cluster:ay36) by smtp.aliyun-inc.com; Fri, 30 Jan 2026 15:34:26 +0800 From: Gao Xiang To: linux-erofs@lists.ozlabs.org Cc: LKML , oliver.yang@linux.alibaba.com, Gao Xiang Subject: [PATCH] erofs: handle end of filesystem properly for file-backed mounts Date: Fri, 30 Jan 2026 15:34:21 +0800 Message-ID: <20260130073421.2012225-1-hsiangkao@linux.alibaba.com> X-Mailer: git-send-email 2.43.5 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" I/O requests beyond the end of the filesystem should be zeroed out, similar to loopback devices and that is what we need. Fixes: ce63cb62d794 ("erofs: support unencoded inodes for fileio") Signed-off-by: Gao Xiang --- fs/erofs/fileio.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/fs/erofs/fileio.c b/fs/erofs/fileio.c index c1d0081609dc..23d9e0c57fb3 100644 --- a/fs/erofs/fileio.c +++ b/fs/erofs/fileio.c @@ -24,12 +24,9 @@ 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 > 0) { - if (ret !=3D rq->bio.bi_iter.bi_size) { - bio_advance(&rq->bio, ret); - zero_fill_bio(&rq->bio); - } - ret =3D 0; + if (ret >=3D 0 && ret !=3D rq->bio.bi_iter.bi_size) { + bio_advance(&rq->bio, ret); + zero_fill_bio(&rq->bio); } if (rq->bio.bi_end_io) { if (ret < 0 && !rq->bio.bi_status) @@ -37,7 +34,7 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, = long ret) } else { bio_for_each_folio_all(fi, &rq->bio) { DBG_BUGON(folio_test_uptodate(fi.folio)); - erofs_onlinefolio_end(fi.folio, ret, false); + erofs_onlinefolio_end(fi.folio, ret < 0, false); } } bio_endio(&rq->bio); @@ -48,7 +45,7 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, = long ret) static void erofs_fileio_rq_submit(struct erofs_fileio_rq *rq) { struct iov_iter iter; - int ret; + ssize_t ret; =20 if (!rq) return; --=20 2.43.5