diff options
author | Keith Busch <keith.busch@intel.com> | 2015-07-14 13:57:48 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-07-15 17:36:47 -0400 |
commit | 7bee607472aa2e5a36dfe143e5a625be06125f53 (patch) | |
tree | f29a2b65c3db1a44c63c44244be1237ca3eb750f | |
parent | 77b5a08427e87514c33730afc18cd02c9475e2c3 (diff) |
NVMe: Reread partitions on metadata formats
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@ranbarg.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Tested-by: Paul Grabinar <paul.grabinar@ranbarg.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | drivers/block/nvme-core.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index d1d6141920d3..7920c2741b47 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) | |||
2108 | goto out_free_disk; | 2108 | goto out_free_disk; |
2109 | 2109 | ||
2110 | add_disk(ns->disk); | 2110 | add_disk(ns->disk); |
2111 | if (ns->ms) | 2111 | if (ns->ms) { |
2112 | revalidate_disk(ns->disk); | 2112 | struct block_device *bd = bdget_disk(ns->disk, 0); |
2113 | if (!bd) | ||
2114 | return; | ||
2115 | if (blkdev_get(bd, FMODE_READ, NULL)) { | ||
2116 | bdput(bd); | ||
2117 | return; | ||
2118 | } | ||
2119 | blkdev_reread_part(bd); | ||
2120 | blkdev_put(bd, FMODE_READ); | ||
2121 | } | ||
2113 | return; | 2122 | return; |
2114 | out_free_disk: | 2123 | out_free_disk: |
2115 | kfree(disk); | 2124 | kfree(disk); |