All of lore.kernel.org
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: xen-devel@lists.xenproject.org, nvdimm@lists.linux.dev,
	linux-nvme@lists.infradead.org, linux-bcache@vger.kernel.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	axboe@kernel.dk, kent.overstreet@gmail.com, kbusch@kernel.org,
	sagi@grimberg.me, vishal.l.verma@intel.com,
	dan.j.williams@intel.com, dave.jiang@intel.com,
	ira.weiny@intel.com, konrad.wilk@oracle.com,
	roger.pau@citrix.com, boris.ostrovsky@oracle.com,
	jgross@suse.com, sstabellini@kernel.org, minchan@kernel.org,
	ngupta@vflare.org, senozhatsky@chromium.org
Subject: Re: [PATCH 02/10] bcache: add error handling support for add_disk()
Date: Sun, 29 Aug 2021 15:50:49 +0800	[thread overview]
Message-ID: <59a4ce06-22ee-7047-487e-621da3f7c507@suse.de> (raw)
In-Reply-To: <20210827191809.3118103-3-mcgrof@kernel.org>

On 8/28/21 3:18 AM, Luis Chamberlain 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.
>
> This driver doesn't do any unwinding with blk_cleanup_disk()
> even on errors after add_disk() and so we follow that
> tradition.
>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Acked-by: Coly Li <colyli@suse.de>

Thanks.

> ---
>   drivers/md/bcache/super.c | 17 ++++++++++++-----
>   1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index f2874c77ff79..f0c32cdd6594 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -1082,7 +1082,9 @@ int bch_cached_dev_run(struct cached_dev *dc)
>   		closure_sync(&cl);
>   	}
>   
> -	add_disk(d->disk);
> +	ret = add_disk(d->disk);
> +	if (ret)
> +		goto out;
>   	bd_link_disk_holder(dc->bdev, dc->disk.disk);
>   	/*
>   	 * won't show up in the uevent file, use udevadm monitor -e instead
> @@ -1534,10 +1536,11 @@ static void flash_dev_flush(struct closure *cl)
>   
>   static int flash_dev_run(struct cache_set *c, struct uuid_entry *u)
>   {
> +	int err = -ENOMEM;
>   	struct bcache_device *d = kzalloc(sizeof(struct bcache_device),
>   					  GFP_KERNEL);
>   	if (!d)
> -		return -ENOMEM;
> +		goto err_ret;
>   
>   	closure_init(&d->cl, NULL);
>   	set_closure_fn(&d->cl, flash_dev_flush, system_wq);
> @@ -1551,9 +1554,12 @@ static int flash_dev_run(struct cache_set *c, struct uuid_entry *u)
>   	bcache_device_attach(d, c, u - c->uuids);
>   	bch_sectors_dirty_init(d);
>   	bch_flash_dev_request_init(d);
> -	add_disk(d->disk);
> +	err = add_disk(d->disk);
> +	if (err)
> +		goto err;
>   
> -	if (kobject_add(&d->kobj, &disk_to_dev(d->disk)->kobj, "bcache"))
> +	err = kobject_add(&d->kobj, &disk_to_dev(d->disk)->kobj, "bcache");
> +	if (err)
>   		goto err;
>   
>   	bcache_device_link(d, c, "volume");
> @@ -1567,7 +1573,8 @@ static int flash_dev_run(struct cache_set *c, struct uuid_entry *u)
>   	return 0;
>   err:
>   	kobject_put(&d->kobj);
> -	return -ENOMEM;
> +err_ret:
> +	return err;
>   }
>   
>   static int flash_devs_run(struct cache_set *c)


WARNING: multiple messages have this Message-ID (diff)
From: Coly Li <colyli@suse.de>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: xen-devel@lists.xenproject.org, nvdimm@lists.linux.dev,
	linux-nvme@lists.infradead.org, linux-bcache@vger.kernel.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	axboe@kernel.dk, kent.overstreet@gmail.com, kbusch@kernel.org,
	sagi@grimberg.me, vishal.l.verma@intel.com,
	dan.j.williams@intel.com, dave.jiang@intel.com,
	ira.weiny@intel.com, konrad.wilk@oracle.com,
	roger.pau@citrix.com, boris.ostrovsky@oracle.com,
	jgross@suse.com, sstabellini@kernel.org, minchan@kernel.org,
	ngupta@vflare.org, senozhatsky@chromium.org
Subject: Re: [PATCH 02/10] bcache: add error handling support for add_disk()
Date: Sun, 29 Aug 2021 15:50:49 +0800	[thread overview]
Message-ID: <59a4ce06-22ee-7047-487e-621da3f7c507@suse.de> (raw)
In-Reply-To: <20210827191809.3118103-3-mcgrof@kernel.org>

On 8/28/21 3:18 AM, Luis Chamberlain 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.
>
> This driver doesn't do any unwinding with blk_cleanup_disk()
> even on errors after add_disk() and so we follow that
> tradition.
>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Acked-by: Coly Li <colyli@suse.de>

Thanks.

> ---
>   drivers/md/bcache/super.c | 17 ++++++++++++-----
>   1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index f2874c77ff79..f0c32cdd6594 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -1082,7 +1082,9 @@ int bch_cached_dev_run(struct cached_dev *dc)
>   		closure_sync(&cl);
>   	}
>   
> -	add_disk(d->disk);
> +	ret = add_disk(d->disk);
> +	if (ret)
> +		goto out;
>   	bd_link_disk_holder(dc->bdev, dc->disk.disk);
>   	/*
>   	 * won't show up in the uevent file, use udevadm monitor -e instead
> @@ -1534,10 +1536,11 @@ static void flash_dev_flush(struct closure *cl)
>   
>   static int flash_dev_run(struct cache_set *c, struct uuid_entry *u)
>   {
> +	int err = -ENOMEM;
>   	struct bcache_device *d = kzalloc(sizeof(struct bcache_device),
>   					  GFP_KERNEL);
>   	if (!d)
> -		return -ENOMEM;
> +		goto err_ret;
>   
>   	closure_init(&d->cl, NULL);
>   	set_closure_fn(&d->cl, flash_dev_flush, system_wq);
> @@ -1551,9 +1554,12 @@ static int flash_dev_run(struct cache_set *c, struct uuid_entry *u)
>   	bcache_device_attach(d, c, u - c->uuids);
>   	bch_sectors_dirty_init(d);
>   	bch_flash_dev_request_init(d);
> -	add_disk(d->disk);
> +	err = add_disk(d->disk);
> +	if (err)
> +		goto err;
>   
> -	if (kobject_add(&d->kobj, &disk_to_dev(d->disk)->kobj, "bcache"))
> +	err = kobject_add(&d->kobj, &disk_to_dev(d->disk)->kobj, "bcache");
> +	if (err)
>   		goto err;
>   
>   	bcache_device_link(d, c, "volume");
> @@ -1567,7 +1573,8 @@ static int flash_dev_run(struct cache_set *c, struct uuid_entry *u)
>   	return 0;
>   err:
>   	kobject_put(&d->kobj);
> -	return -ENOMEM;
> +err_ret:
> +	return err;
>   }
>   
>   static int flash_devs_run(struct cache_set *c)


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2021-08-29  7:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27 19:17 [PATCH 00/10] block: first batch of add_disk() error handling conversions Luis Chamberlain
2021-08-27 19:17 ` Luis Chamberlain
2021-08-27 19:18 ` [PATCH 01/10] block/brd: add error handling support for add_disk() Luis Chamberlain
2021-08-27 19:18   ` Luis Chamberlain
2021-08-27 19:18 ` [PATCH 02/10] bcache: " Luis Chamberlain
2021-08-27 19:18   ` Luis Chamberlain
2021-08-29  7:50   ` Coly Li [this message]
2021-08-29  7:50     ` Coly Li
2021-08-27 19:18 ` [PATCH 03/10] nvme-multipath: " Luis Chamberlain
2021-08-27 19:18   ` Luis Chamberlain
2021-08-27 20:29   ` Keith Busch
2021-08-27 20:29     ` Keith Busch
2021-08-30 21:08     ` Luis Chamberlain
2021-08-30 21:08       ` Luis Chamberlain
2021-08-27 19:18 ` [PATCH 04/10] nvdimm/btt: do not call del_gendisk() if not needed Luis Chamberlain
2021-08-27 19:18   ` Luis Chamberlain
2021-08-27 19:18 ` [PATCH 05/10] nvdimm/btt: use goto error labels on btt_blk_init() Luis Chamberlain
2021-08-27 19:18   ` Luis Chamberlain
2021-08-27 19:18 ` [PATCH 06/10] nvdimm/btt: add error handling support for add_disk() Luis Chamberlain
2021-08-27 19:18   ` Luis Chamberlain
2021-08-27 19:18 ` [PATCH 07/10] nvdimm/blk: avoid calling del_gendisk() on early failures Luis Chamberlain
2021-08-27 19:18   ` Luis Chamberlain
2021-08-27 19:18 ` [PATCH 08/10] nvdimm/blk: add error handling support for add_disk() Luis Chamberlain
2021-08-27 19:18   ` Luis Chamberlain
2021-08-27 19:18 ` [PATCH 09/10] xen-blkfront: " Luis Chamberlain
2021-08-27 19:18   ` Luis Chamberlain
2021-08-27 19:18 ` [PATCH 10/10] zram: " Luis Chamberlain
2021-08-27 19:18   ` Luis Chamberlain
2021-08-27 19:19 ` [PATCH 00/10] block: first batch of add_disk() error handling conversions Luis Chamberlain
2021-08-27 19:19   ` 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=59a4ce06-22ee-7047-487e-621da3f7c507@suse.de \
    --to=colyli@suse.de \
    --cc=axboe@kernel.dk \
    --cc=boris.ostrovsky@oracle.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=jgross@suse.com \
    --cc=kbusch@kernel.org \
    --cc=kent.overstreet@gmail.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=mcgrof@kernel.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=roger.pau@citrix.com \
    --cc=sagi@grimberg.me \
    --cc=senozhatsky@chromium.org \
    --cc=sstabellini@kernel.org \
    --cc=vishal.l.verma@intel.com \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.