All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Matias Bjørling" <m@bjorling.me>
To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, axboe@fb.com
Cc: "Matias Bjørling" <m@bjorling.me>
Subject: [PATCH 3/3] null_blk: do not del gendisk with lightnvm
Date: Thu, 19 Nov 2015 12:50:10 +0100	[thread overview]
Message-ID: <1447933810-10267-4-git-send-email-m@bjorling.me> (raw)
In-Reply-To: <1447933810-10267-1-git-send-email-m@bjorling.me>

The gendisk structure has not been initialized when using lightnvm.
Make sure to not delete it upon exit. Also make sure that we use the
appropriate disk_name at unregistration.

Signed-off-by: Matias Bjørling <m@bjorling.me>
---
 drivers/block/null_blk.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index 6184b82..fb70b54 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -435,12 +435,14 @@ static void null_del_dev(struct nullb *nullb)
 	list_del_init(&nullb->list);
 
 	if (use_lightnvm)
-		nvm_unregister(nullb->disk->disk_name);
-	del_gendisk(nullb->disk);
+		nvm_unregister(nullb->disk_name);
+	else
+		del_gendisk(nullb->disk);
 	blk_cleanup_queue(nullb->q);
 	if (queue_mode == NULL_Q_MQ)
 		blk_mq_free_tag_set(&nullb->tag_set);
-	put_disk(nullb->disk);
+	if (!use_lightnvm)
+		put_disk(nullb->disk);
 	cleanup_queues(nullb);
 	kfree(nullb);
 }
-- 
2.1.4


  parent reply	other threads:[~2015-11-19 11:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19 11:50 [PATCH 0/3] null_blk patches for 4.4-rc2 Matias Bjørling
2015-11-19 11:50 ` [PATCH 1/3] null_blk: use ppa_cache pool Matias Bjørling
2015-11-19 11:50 ` [PATCH 2/3] null_blk: use device addressing mode Matias Bjørling
2015-11-19 11:50 ` Matias Bjørling [this message]
2015-11-19 20:06 ` [PATCH 0/3] null_blk patches for 4.4-rc2 Jens Axboe

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=1447933810-10267-4-git-send-email-m@bjorling.me \
    --to=m@bjorling.me \
    --cc=axboe@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 3/3] null_blk: do not del gendisk with lightnvm' \
    /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

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.