Message ID | 1536560508-24564-4-git-send-email-oceanhehy@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | libnvdimm: reset seeds for next namespace creation | expand |
Hi Ocean,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linux-nvdimm/libnvdimm-for-next]
[also build test WARNING on v4.19-rc3 next-20180910]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Ocean-He/libnvdimm-reset-seeds-for-next-namespace-creation/20180911-005505
base: https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git libnvdimm-for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__
sparse warnings: (new ones prefixed by >>)
drivers/nvdimm/region_devs.c:84:29: sparse: expression using sizeof(void)
drivers/nvdimm/region_devs.c:84:29: sparse: expression using sizeof(void)
drivers/nvdimm/region_devs.c:405:37: sparse: expression using sizeof(void)
drivers/nvdimm/region_devs.c:405:37: sparse: expression using sizeof(void)
>> drivers/nvdimm/region_devs.c:710:6: sparse: symbol 'nd_region_detach_and_reset' was not declared. Should it be static?
drivers/nvdimm/region_devs.c:1127:31: sparse: expression using sizeof(void)
drivers/nvdimm/region_devs.c:985:9: sparse: context imbalance in 'nd_region_acquire_lane' - wrong count at exit
drivers/nvdimm/region_devs.c:998:36: sparse: context imbalance in 'nd_region_release_lane' - unexpected unlock
Please review and possibly fold the followup patch.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index fa37afc..4c46fb6 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -703,7 +703,27 @@ void nd_mapping_free_labels(struct nd_mapping *nd_mapping) kfree(label_ent); } } +/* + * To ensure pfn_seed/dax_seed and namespace_seed are ready for + * next namespace creation, here to do detach and reset. + */ +void nd_region_detach_and_reset(struct device *dev, + struct nd_region *nd_region) +{ + /* Only nd_pmem has been verified, fix me for other dev type. */ + if (!is_nd_pmem(&nd_region->dev)) + return; + if (is_nd_pfn(dev) || is_nd_dax(dev)) { + struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev); + struct nd_namespace_common *ndns = to_ndns(nd_region->ns_seed); + + if (nd_pfn->ndns == ndns && ndns->claim == dev) { + nd_detach_and_reset(dev, &nd_pfn->ndns); + nd_region_reset_ns_seed(nd_region); + } + } +} /* * Upon successful probe/remove, take/release a reference on the * associated interleave set (if present), and plant new btt + namespace @@ -774,6 +794,20 @@ static void nd_region_notify_driver_action(struct nvdimm_bus *nvdimm_bus, nd_region_create_ns_seed(nd_region); nvdimm_bus_unlock(dev); } + if (is_nd_pfn(dev) && !probe) { + nd_region = to_nd_region(dev->parent); + nvdimm_bus_lock(dev); + if (nd_region->pfn_seed == dev) + nd_region_detach_and_reset(dev, nd_region); + nvdimm_bus_unlock(dev); + } + if (is_nd_dax(dev) && !probe) { + nd_region = to_nd_region(dev->parent); + nvdimm_bus_lock(dev); + if (nd_region->dax_seed == dev) + nd_region_detach_and_reset(dev, nd_region); + nvdimm_bus_unlock(dev); + } } void nd_region_probe_success(struct nvdimm_bus *nvdimm_bus, struct device *dev)