Re: [PATCH] blk-core: use pr_warn_ratelimited() in bio_check_ro()

From: Yu Kuai
Date: Wed Nov 08 2023 - 03:17:57 EST


Hi,

在 2023/11/08 15:16, Christoph Hellwig 写道:
On Tue, Nov 07, 2023 at 07:12:47PM +0800, Yu Kuai wrote:
From: Yu Kuai <yukuai3@xxxxxxxxxx>

If one of the underlying disks of raid or dm is set to read-only, then
each io will generate new log, which will cause message storm. This
environment is indeed problematic, however we can't make sure our
naive custormer won't do this, hence use pr_warn_ratelimited() to
prevent message storm in this case.

Reducing the log spam sounds good, and I guess the single warning
would be even better.

Got it.

Jens, I see that you already apply this version, do you want me to send
a new version to generate single warning for each block_device?

That being said, why/how is the underlying device set to read-only?
If there is a good reason we should probably add a holder op to tell
the user about it so that it stop sending writes.

Our custormer use blockdev --getro to underlying device directly,
they're trying to forbid other users to write underlying device, so
in this case I think set underlying device to read-only is not okay
because it's already write opened, however I'm not sure if we want the
ioctl to fail.

Thanks,
Kuai

.