diff mbox series

[v2,01/13] nvdimm/btt: do not call del_gendisk() if not needed

Message ID 20211103122157.1215783-2-mcgrof@kernel.org (mailing list archive)
State Superseded
Headers show
Series block: add_disk() error handling stragglers | expand

Commit Message

Luis Chamberlain Nov. 3, 2021, 12:21 p.m. UTC
del_gendisk() is not required if the disk has not been added.
On kernels prior to commit 40b3a52ffc5bc3 ("block: add a sanity
check for a live disk in del_gendisk") it is mandatory to not
call del_gendisk() if the underlying device has not been through
device_add().

Fixes: 41cd8b70c37a ("libnvdimm, btt: add support for blk integrity")
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 drivers/nvdimm/btt.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Christoph Hellwig Nov. 3, 2021, 4:02 p.m. UTC | #1
On Wed, Nov 03, 2021 at 05:21:45AM -0700, Luis Chamberlain wrote:
> del_gendisk() is not required if the disk has not been added.
> On kernels prior to commit 40b3a52ffc5bc3 ("block: add a sanity
> check for a live disk in del_gendisk") it is mandatory to not
> call del_gendisk() if the underlying device has not been through
> device_add().

And even with the sanity check is it wrong, and will trigger a WARN_ON.
So maybe this commit log could use a little update?

With that fixed I think this should go into 5.16 and -stable.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Luis Chamberlain Nov. 3, 2021, 4:58 p.m. UTC | #2
On Wed, Nov 03, 2021 at 05:02:43PM +0100, Christoph Hellwig wrote:
> On Wed, Nov 03, 2021 at 05:21:45AM -0700, Luis Chamberlain wrote:
> > del_gendisk() is not required if the disk has not been added.
> > On kernels prior to commit 40b3a52ffc5bc3 ("block: add a sanity
> > check for a live disk in del_gendisk") it is mandatory to not
> > call del_gendisk() if the underlying device has not been through
> > device_add().
> 
> And even with the sanity check is it wrong, and will trigger a WARN_ON.
> So maybe this commit log could use a little update?
> 
> With that fixed I think this should go into 5.16 and -stable.
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>

OK true, the first WARN_ON() was added on v5.11 through commit 6b3ba9762f9f9
("block: cleanup del_gendisk a bit") though, before that, it is still
wrong. Will send a v3 for this patch alone.

  Luis
diff mbox series

Patch

diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index f10a50ffa047..a62f23b945f1 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1537,7 +1537,6 @@  static int btt_blk_init(struct btt *btt)
 		int rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt));
 
 		if (rc) {
-			del_gendisk(btt->btt_disk);
 			blk_cleanup_disk(btt->btt_disk);
 			return rc;
 		}