mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Minfei Huang <mnfhuang@gmail.com>
To: axboe@fb.com, m@bjorling.me, akinobu.mita@gmail.com,
	rusty@rustcorp.com.au, keith.busch@intel.com, mcgrof@suse.com,
	krinkin.m.u@gmail.com
Cc: linux-kernel@vger.kernel.org, mhuang@redhat.com,
	Minfei Huang <mnfhuang@gmail.com>
Subject: [PATCH 1/2] null_blk: Remove null block from list in error path
Date: Fri, 27 Nov 2015 21:26:12 +0800	[thread overview]
Message-ID: <1448630773-4119-1-git-send-email-mnfhuang@gmail.com> (raw)

To make consistent of null block list, we should remove enqueued null
block from the list before freeing it.

Signed-off-by: Minfei Huang <mnfhuang@gmail.com>
---
 drivers/block/null_blk.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index ec99568..729ecd7 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -738,7 +738,7 @@ static int null_add_dev(void)
 		rv = nvm_register(nullb->q, nullb->disk_name,
 							&null_lnvm_dev_ops);
 		if (rv)
-			goto out_cleanup_blk_queue;
+			goto out_cleanup_blk_list;
 		goto done;
 	}
 
@@ -765,6 +765,10 @@ done:
 out_cleanup_lightnvm:
 	if (use_lightnvm)
 		nvm_unregister(nullb->disk_name);
+out_cleanup_blk_list:
+	mutex_lock(&lock);
+	list_del_init(&nullb->list);
+	mutex_unlock(&lock);
 out_cleanup_blk_queue:
 	blk_cleanup_queue(nullb->q);
 out_cleanup_tags:
-- 
1.8.3.1


             reply	other threads:[~2015-11-27 13:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 13:26 Minfei Huang [this message]
2015-11-27 13:26 ` [PATCH 2/2] null_blk: Do a cleanup for function null_add_dev Minfei Huang
2015-12-14 11:43   ` Minfei Huang
2015-12-09  5:21 ` [PATCH 1/2] null_blk: Remove null block from list in error path Minfei Huang
2015-12-09  8:14   ` Matias Bjørling

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=1448630773-4119-1-git-send-email-mnfhuang@gmail.com \
    --to=mnfhuang@gmail.com \
    --cc=akinobu.mita@gmail.com \
    --cc=axboe@fb.com \
    --cc=keith.busch@intel.com \
    --cc=krinkin.m.u@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m@bjorling.me \
    --cc=mcgrof@suse.com \
    --cc=mhuang@redhat.com \
    --cc=rusty@rustcorp.com.au \
    /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