From: Su Yue <l@damenly.org>
To: ghuicao@163.com
Cc: Mike Snitzer <snitzer@kernel.org>,
Alasdair Kergon <agk@redhat.com>,
Mikulas Patocka <mpatocka@redhat.com>,
Benjamin Marzinski <bmarzins@redhat.com>,
dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
Cao Guanghui <caoguanghui@kylinos.cn>
Subject: Re: [PATCH 2/2] dm era: fix error code propagation in era_ctr()
Date: Thu, 18 Jun 2026 19:58:27 +0800 [thread overview]
Message-ID: <ik7gt5zw.fsf@damenly.org> (raw)
In-Reply-To: <20260617060053.71051-3-ghuicao@163.com> (ghuicao@163.com's message of "Wed, 17 Jun 2026 14:00:53 +0800")
On Wed 17 Jun 2026 at 14:00, ghuicao@163.com wrote:
> From: Cao Guanghui <caoguanghui@kylinos.cn>
>
> era_ctr() replaces the actual error codes returned by
> dm_get_device()
> and dm_set_target_max_io_len() with hardcoded -EINVAL,
> discarding
> the real reason for the failure (e.g. -ENODEV, -ENOMEM). This
> makes
> it harder for users to diagnose problems and is inconsistent
> with
> other dm targets (dm-thin, dm-verity, dm-flakey, dm-ebs) which
> propagate the original error.
>
> Fix all three sites to return 'r' instead of -EINVAL.
>
> Signed-off-by: Cao Guanghui <caoguanghui@kylinos.cn>
>
Reviewed-by: Su Yue <glass.su@suse.com>
> ---
> drivers/md/dm-era-target.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/md/dm-era-target.c
> b/drivers/md/dm-era-target.c
> index 08ce96e8cf4f..4eb1c4f90e1b 100644
> --- a/drivers/md/dm-era-target.c
> +++ b/drivers/md/dm-era-target.c
> @@ -1488,7 +1488,7 @@ static int era_ctr(struct dm_target *ti,
> unsigned int argc, char **argv)
> if (r) {
> ti->error = "Error opening metadata device";
> era_destroy(era);
> - return -EINVAL;
> + return r;
> }
>
> r = dm_get_device(ti, argv[1], BLK_OPEN_READ | BLK_OPEN_WRITE,
> @@ -1496,7 +1496,7 @@ static int era_ctr(struct dm_target *ti,
> unsigned int argc, char **argv)
> if (r) {
> ti->error = "Error opening data device";
> era_destroy(era);
> - return -EINVAL;
> + return r;
> }
>
> r = sscanf(argv[2], "%u%c", &era->sectors_per_block, &dummy);
> @@ -1510,7 +1510,7 @@ static int era_ctr(struct dm_target *ti,
> unsigned int argc, char **argv)
> if (r) {
> ti->error = "could not set max io len";
> era_destroy(era);
> - return -EINVAL;
> + return r;
> }
>
> if (!valid_block_size(era->sectors_per_block)) {
next prev parent reply other threads:[~2026-06-18 12:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-17 6:00 [PATCH 0/2] dm era: fix metadata_open NULL deref and error propagation ghuicao
2026-06-17 6:00 ` [PATCH 1/2] dm era: fix NULL pointer dereference in metadata_open() ghuicao
2026-06-18 11:55 ` Su Yue
2026-06-24 14:09 ` Ming Hung Tsai
2026-06-17 6:00 ` [PATCH 2/2] dm era: fix error code propagation in era_ctr() ghuicao
2026-06-18 11:58 ` Su Yue [this message]
2026-06-24 14:06 ` Ming Hung Tsai
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=ik7gt5zw.fsf@damenly.org \
--to=l@damenly.org \
--cc=agk@redhat.com \
--cc=bmarzins@redhat.com \
--cc=caoguanghui@kylinos.cn \
--cc=dm-devel@lists.linux.dev \
--cc=ghuicao@163.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.org \
/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