linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NVMe: Reread partitions on metadata formats
@ 2015-07-14 17:57 Keith Busch
  2015-07-14 18:49 ` Jens Axboe
  0 siblings, 1 reply; 60+ messages in thread
From: Keith Busch @ 2015-07-14 17:57 UTC (permalink / raw)


This patch has the driver automatically reread partitions if a namespace
has a separate metadata format. Previously revalidating a disk was
sufficient to get the correct capacity set on such formatted drives,
but partitions that may exist would not have been surfaced.

Reported-by: Paul Grabinar <paul.grabinar at ranbarg.com>
Signed-off-by: Keith Busch <keith.busch at intel.com>
Cc: Matthew Wilcox <willy at linux.intel.com>
Cc: Jens Axboe <axboe at fb.com>
---
 drivers/block/nvme-core.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index d1d6141..7920c27 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -2108,8 +2108,17 @@ static void nvme_alloc_ns(struct nvme_dev *dev, unsigned nsid)
 		goto out_free_disk;
 
 	add_disk(ns->disk);
-	if (ns->ms)
-		revalidate_disk(ns->disk);
+	if (ns->ms) {
+		struct block_device *bd = bdget_disk(ns->disk, 0);
+		if (!bd)
+			return;
+		if (blkdev_get(bd, FMODE_READ, NULL)) {
+			bdput(bd);
+			return;
+		}
+		blkdev_reread_part(bd);
+		blkdev_put(bd, FMODE_READ);
+	}
 	return;
  out_free_disk:
 	kfree(disk);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 60+ messages in thread

end of thread, other threads:[~2015-10-14 22:42 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-14 17:57 [PATCH] NVMe: Reread partitions on metadata formats Keith Busch
2015-07-14 18:49 ` Jens Axboe
2015-07-14 19:01   ` Paul Grabinar
2015-07-15  3:48   ` Dan Williams
2015-07-15 21:36     ` Jens Axboe
2015-07-15 22:28       ` Keith Busch
2015-07-16  9:19         ` Christoph Hellwig
2015-07-17  1:47           ` Martin K. Petersen
2015-07-17  9:30             ` Christoph Hellwig
2015-07-21  6:02           ` Data integrity tweaks Martin K. Petersen
2015-07-21  6:02             ` [PATCH 1/5] block: Move integrity kobject to struct gendisk Martin K. Petersen
2015-07-22 11:32               ` Sagi Grimberg
2015-07-21  6:02             ` [PATCH 2/5] block: Consolidate static integrity profile properties Martin K. Petersen
2015-07-22 11:33               ` Sagi Grimberg
2015-07-21  6:02             ` [PATCH 3/5] block: Reduce the size of struct blk_integrity Martin K. Petersen
2015-07-21 11:53               ` Christoph Hellwig
2015-07-24 15:14                 ` Martin K. Petersen
2015-07-22 11:35               ` Sagi Grimberg
2015-07-21  6:02             ` [PATCH 4/5] block: Export integrity data interval size in sysfs Martin K. Petersen
2015-07-22 11:37               ` Sagi Grimberg
2015-07-24 15:26                 ` Martin K. Petersen
2015-07-21  6:02             ` [PATCH 5/5] block: Inline blk_integrity in struct gendisk Martin K. Petersen
2015-07-21 12:01               ` Christoph Hellwig
2015-08-20 20:41                 ` Simplify block integrity registration Martin K. Petersen
2015-08-20 20:41                   ` [PATCH 1/5] block: Move integrity kobject to struct gendisk Martin K. Petersen
2015-09-16 17:26                     ` Mike Snitzer
2015-08-20 20:41                   ` [PATCH 2/5] block: Consolidate static integrity profile properties Martin K. Petersen
2015-08-20 20:41                   ` [PATCH 3/5] block: Reduce the size of struct blk_integrity Martin K. Petersen
2015-08-20 20:41                   ` [PATCH 4/5] block: Export integrity data interval size in sysfs Martin K. Petersen
2015-08-20 20:41                   ` [PATCH 5/5] block: Inline blk_integrity in struct gendisk Martin K. Petersen
2015-08-21 23:47                     ` Busch, Keith
2015-08-27  0:25                       ` Martin K. Petersen
2015-08-27  0:25                       ` [PATCH] " Martin K. Petersen
2015-08-27  8:28                         ` Christoph Hellwig
2015-09-03 20:38                         ` Keith Busch
2015-09-04  3:25                           ` Martin K. Petersen
2015-10-12 21:05                       ` Block integrity registration update Martin K. Petersen
2015-10-12 21:05                         ` [PATCH 1/5] block: Move integrity kobject to struct gendisk Martin K. Petersen
2015-10-12 21:05                         ` [PATCH 2/5] block: Consolidate static integrity profile properties Martin K. Petersen
2015-10-14  1:11                           ` Dan Williams
2015-10-14  7:23                             ` Christoph Hellwig
2015-10-14 19:42                               ` Williams, Dan J
2015-10-14 19:47                                 ` hch
2015-10-14 20:00                                   ` Williams, Dan J
2015-10-14 22:42                                     ` Martin K. Petersen
2015-10-12 21:05                         ` [PATCH 3/5] block: Reduce the size of struct blk_integrity Martin K. Petersen
2015-10-12 21:05                         ` [PATCH 4/5] block: Export integrity data interval size in sysfs Martin K. Petersen
2015-10-12 21:05                         ` [PATCH 5/5] block: Inline blk_integrity in struct gendisk Martin K. Petersen
2015-10-12 23:06                           ` Mike Snitzer
2015-10-13  0:31                         ` Block integrity registration update Williams, Dan J
2015-10-13  1:53                           ` Williams, Dan J
2015-10-13 12:26                             ` hch
2015-10-13 17:38                               ` Dan Williams
2015-09-16  1:07                     ` [PATCH 5/5] block: Inline blk_integrity in struct gendisk Mike Snitzer
2015-09-21 20:45                       ` Mike Snitzer
2015-10-09  7:36                         ` Christoph Hellwig
2015-10-12  1:17                           ` Martin K. Petersen
2015-08-20 20:45                   ` Simplify block integrity registration Mike Snitzer
2015-07-17  1:44         ` [PATCH] NVMe: Reread partitions on metadata formats Martin K. Petersen
2015-07-15 17:37   ` Paul Grabinar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).