From: Jinpu Wang <jinpu.wang@ionos.com>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>, Bjorn Helgaas <bhelgaas@google.com>,
Liu Shixin <liushixin2@huawei.com>,
Zhen Lei <thunder.leizhen@huawei.com>,
Lee Jones <lee.jones@linaro.org>,
Geoff Levand <geoff@infradead.org>,
Michael Ellerman <mpe@ellerman.id.au>,
benh@kernel.crashing.org, paulus@samba.org, jim@jtan.com,
Haris Iqbal <haris.iqbal@ionos.com>,
josh.h.morris@us.ibm.com, pjk1939@linux.ibm.com,
Tim Waugh <tim@cyberelk.net>, Richard Weinberger <richard@nod.at>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Vignesh Raghavendra <vigneshr@ti.com>,
linux-mtd@lists.infradead.org, linuxppc-dev@lists.ozlabs.org,
linux-block <linux-block@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 05/10] rnbd: add error handling support for add_disk()
Date: Thu, 2 Sep 2021 07:32:44 +0200 [thread overview]
Message-ID: <CAMGffE=+jnKpO-ZGqW5JQnUbdH+NjQHgq7_f4XoEem2itHhe9Q@mail.gmail.com> (raw)
In-Reply-To: <20210901210028.1750956-6-mcgrof@kernel.org>
On Wed, Sep 1, 2021 at 11:01 PM Luis Chamberlain <mcgrof@kernel.org> wrote:
>
> We never checked for errors on add_disk() as this function
> returned void. Now that this is fixed, use the shiny new
> error handling.
>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
looks good to me.
Acked-by: Jack Wang <jinpu.wang@ionos.com>
> ---
> drivers/block/rnbd/rnbd-clt.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/block/rnbd/rnbd-clt.c b/drivers/block/rnbd/rnbd-clt.c
> index bd4a41afbbfc..1ba1c868535a 100644
> --- a/drivers/block/rnbd/rnbd-clt.c
> +++ b/drivers/block/rnbd/rnbd-clt.c
> @@ -1384,8 +1384,10 @@ static void setup_request_queue(struct rnbd_clt_dev *dev)
> blk_queue_write_cache(dev->queue, dev->wc, dev->fua);
> }
>
> -static void rnbd_clt_setup_gen_disk(struct rnbd_clt_dev *dev, int idx)
> +static int rnbd_clt_setup_gen_disk(struct rnbd_clt_dev *dev, int idx)
> {
> + int err;
> +
> dev->gd->major = rnbd_client_major;
> dev->gd->first_minor = idx << RNBD_PART_BITS;
> dev->gd->minors = 1 << RNBD_PART_BITS;
> @@ -1410,7 +1412,11 @@ static void rnbd_clt_setup_gen_disk(struct rnbd_clt_dev *dev, int idx)
>
> if (!dev->rotational)
> blk_queue_flag_set(QUEUE_FLAG_NONROT, dev->queue);
> - add_disk(dev->gd);
> + err = add_disk(dev->gd);
> + if (err)
> + blk_cleanup_disk(dev->gd);
> +
> + return err;
> }
>
> static int rnbd_client_setup_device(struct rnbd_clt_dev *dev)
> @@ -1426,8 +1432,7 @@ static int rnbd_client_setup_device(struct rnbd_clt_dev *dev)
> rnbd_init_mq_hw_queues(dev);
>
> setup_request_queue(dev);
> - rnbd_clt_setup_gen_disk(dev, idx);
> - return 0;
> + return rnbd_clt_setup_gen_disk(dev, idx);
> }
>
> static struct rnbd_clt_dev *init_dev(struct rnbd_clt_session *sess,
> --
> 2.30.2
>
next prev parent reply other threads:[~2021-09-02 5:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-01 21:00 [PATCH 00/10] block: fourth batch of add_disk() error handling conversions Luis Chamberlain
2021-09-01 21:00 ` [PATCH 01/10] mtip32xx: add error handling support for add_disk() Luis Chamberlain
2021-09-01 21:00 ` [PATCH 02/10] pktcdvd: " Luis Chamberlain
2021-09-01 21:00 ` [PATCH 03/10] ps3disk: " Luis Chamberlain
2021-09-01 21:00 ` [PATCH 04/10] ps3vram: " Luis Chamberlain
2021-09-01 21:00 ` [PATCH 05/10] rnbd: " Luis Chamberlain
2021-09-02 5:32 ` Jinpu Wang [this message]
2021-09-01 21:00 ` [PATCH 06/10] block/rsxx: " Luis Chamberlain
2021-09-01 21:00 ` [PATCH 07/10] block/sunvdc: " Luis Chamberlain
2021-09-01 21:00 ` [PATCH 08/10] block/sx8: " Luis Chamberlain
2021-09-01 21:00 ` [PATCH 09/10] pf: " Luis Chamberlain
2021-09-01 21:00 ` [PATCH 10/10] mtd/ubi/block: " Luis Chamberlain
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='CAMGffE=+jnKpO-ZGqW5JQnUbdH+NjQHgq7_f4XoEem2itHhe9Q@mail.gmail.com' \
--to=jinpu.wang@ionos.com \
--cc=axboe@kernel.dk \
--cc=benh@kernel.crashing.org \
--cc=bhelgaas@google.com \
--cc=geoff@infradead.org \
--cc=haris.iqbal@ionos.com \
--cc=jim@jtan.com \
--cc=josh.h.morris@us.ibm.com \
--cc=lee.jones@linaro.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=liushixin2@huawei.com \
--cc=mcgrof@kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=pjk1939@linux.ibm.com \
--cc=richard@nod.at \
--cc=thunder.leizhen@huawei.com \
--cc=tim@cyberelk.net \
--cc=vigneshr@ti.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;
as well as URLs for NNTP newsgroup(s).