mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: Yifan Zhao <zhaoyifan28@huawei.com>, linux-erofs@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org, yekelu1@huawei.com,
	jingrui@huawei.com, zhukeqian1@huawei.com
Subject: Re: [PATCH] erofs: prevent buffered read bio merges across device chunks
Date: Fri, 12 Jun 2026 11:42:38 +0800	[thread overview]
Message-ID: <58bef9af-0926-4948-b917-e38c3793f596@linux.alibaba.com> (raw)
In-Reply-To: <20260612033244.993507-1-zhaoyifan28@huawei.com>



On 2026/6/12 11:32, Yifan Zhao wrote:
> EROFS chunked files may place adjacent logical chunks on different
> devices. The physical block numbers are per-device, so two neighboring
> chunks can still look sector-contiguous to the generic iomap buffered
> read code.
> 
> For example:
> 
>          logical file offset
>          0          8K         16K        24K
>          +----------+----------+----------+
>          | chunk 0  | chunk 1  | chunk 2  |
>          +----------+----------+----------+
>               |          |          |
>               v          v          v
>            dev 1      dev 3      dev 3
>            sector 8   sector 24  sector 40
> 
> The transition from chunk 0 to chunk 1 crosses a device boundary, but
> iomap can still treat sector-contiguous bios as mergeable without
> checking whether they belong to the same device.
> 
> The pending bio, however, is still bound to the previous block device:
> 
>          bio->bi_bdev = dev 1
> 
>          file 0..8K   -> dev 1, sector 8
>          file 8..16K  -> dev 3, sector 24
>                           (must not be added here)
> 
> If the second range is added to the same bio, it will be submitted to
> dev 1 and read from the wrong backing device, which is easy to trigger
> with readahead.
> 
> This only affects paths using erofs_aops, where buffered reads go
> through iomap bio helpers.
> 
> Fix by install EROFS-specific iomap read ops and split the pending
> buffered read bio whenever the next mapped range belongs to a different
> bdev. After the split, fall back to the generic iomap bio read helper
> for the normal sector-based merge checks.
> 
> Reported-by: Kelu Ye <yekelu1@huawei.com>
> Assisted-by: Codex:GPT-5.5
> Signed-off-by: Yifan Zhao <zhaoyifan28@huawei.com>

I think it's an iomap bug instead, see:

iomap_bio_read_folio_range(), we should fix iomap instead.

Thanks,
Gao Xiang


  reply	other threads:[~2026-06-12  3:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12  3:32 Yifan Zhao
2026-06-12  3:42 ` Gao Xiang [this message]
2026-06-12  6:25   ` don't merge bios over iomap boundaries, was: " Christoph Hellwig
2026-06-12  6:54     ` Gao Xiang
2026-06-12  7:10       ` Christoph Hellwig
2026-06-12  7:19         ` Gao Xiang
2026-06-12  7:35           ` Gao Xiang
2026-06-12  8:04             ` Christoph Hellwig
2026-06-12  8:01           ` Christoph Hellwig
2026-06-18  7:16     ` zhaoyifan (H)
2026-06-18  9:00       ` Christoph Hellwig
2026-06-18 10:14         ` Gao Xiang
2026-06-18 10:27           ` Christoph Hellwig
2026-06-18 10:53             ` Gao Xiang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58bef9af-0926-4948-b917-e38c3793f596@linux.alibaba.com \
    --to=hsiangkao@linux.alibaba.com \
    --cc=jingrui@huawei.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yekelu1@huawei.com \
    --cc=zhaoyifan28@huawei.com \
    --cc=zhukeqian1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome