All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: axboe@kernel.dk
Cc: hch@lst.de, Bart.VanAssche@wdc.com, dm-devel@redhat.com,
	linux-block@vger.kernel.org
Subject: [for-4.16 PATCH v2 1/3] block: only bdi_unregister() in del_gendisk() if !GENHD_FL_HIDDEN
Date: Tue,  9 Jan 2018 21:41:02 -0500	[thread overview]
Message-ID: <20180110024104.34885-2-snitzer@redhat.com> (raw)
In-Reply-To: <20180110024104.34885-1-snitzer@redhat.com>

device_add_disk() will only call bdi_register_owner() if
!GENHD_FL_HIDDEN so it follows that bdi_unregister() should be avoided
for !GENHD_FL_HIDDEN in del_gendisk().

Found with code inspection.  bdi_unregister() won't do much harm if
bdi_register_owner() wasn't used but best to avoid it.

Fixes: 8ddcd65325 ("block: introduce GENHD_FL_HIDDEN")
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
 block/genhd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block/genhd.c b/block/genhd.c
index 96a66f671720..00620e01e043 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -725,7 +725,8 @@ void del_gendisk(struct gendisk *disk)
 		 * Unregister bdi before releasing device numbers (as they can
 		 * get reused and we'd get clashes in sysfs).
 		 */
-		bdi_unregister(disk->queue->backing_dev_info);
+		if (!(disk->flags & GENHD_FL_HIDDEN))
+			bdi_unregister(disk->queue->backing_dev_info);
 		blk_unregister_queue(disk);
 	} else {
 		WARN_ON(1);
-- 
2.15.0

  reply	other threads:[~2018-01-10  2:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10  2:41 [for-4.16 PATCH v2 0/3] block: some genhd changes Mike Snitzer
2018-01-10  2:41 ` Mike Snitzer [this message]
2018-01-10  4:35   ` [for-4.16 PATCH v2 1/3] block: only bdi_unregister() in del_gendisk() if !GENHD_FL_HIDDEN Mike Snitzer
2018-01-10  8:31   ` Christoph Hellwig
2018-01-10  2:41 ` [for-4.16 PATCH v2 2/3] block: cope with gendisk's 'queue' being added later Mike Snitzer
2018-01-10  3:46   ` [dm-devel] " Ming Lei
2018-01-10  4:21     ` Mike Snitzer
2018-01-10  7:55       ` Ming Lei
2018-01-10 14:20         ` Mike Snitzer
2018-01-10  8:32   ` Christoph Hellwig
2018-01-10 12:01     ` Hannes Reinecke
2018-01-10  2:41 ` [for-4.16 PATCH v2 3/3] dm: fix awkward request_queue initialization Mike Snitzer

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=20180110024104.34885-2-snitzer@redhat.com \
    --to=snitzer@redhat.com \
    --cc=Bart.VanAssche@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.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.