diff --git a/.gitignore b/.gitignore index 54fcce2..79e4bb1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /libnvme-1.0-rc4.tar.gz /libnvme-1.0-rc5.tar.gz /libnvme-1.0-rc6.tar.gz +/libnvme-1.0-rc7.tar.gz diff --git a/libnvme.spec b/libnvme.spec index 2b02993..e607c2e 100644 --- a/libnvme.spec +++ b/libnvme.spec @@ -3,12 +3,16 @@ Name: libnvme Summary: Linux-native nvme device management library -Version: 1.0~rc6 +Version: 1.0~rc7 Release: 1%{?dist} License: LGPLv2+ URL: https://github.com/linux-nvme/libnvme Source0: %{url}/archive/v%{version_no_tilde}/%{name}-%{version_no_tilde}.tar.gz +# backport from upstream +Patch1: nvme_scan_ctrl_1.patch +Patch2: nvme_scan_ctrl_2.patch + BuildRequires: gcc gcc-c++ BuildRequires: swig BuildRequires: python3-devel @@ -41,12 +45,14 @@ BuildRequires: python3-sphinx_rtd_theme %description doc This package contains the reference manual for %{name}. -%package -n python3-nvme +%package -n python3-libnvme Summary: Python3 bindings for libnvme Requires: %{name}%{?_isa} = %{version}-%{release} -%{?python_provide:%python_provide python3-nvme} +Provides: python3-nvme = %{version}-%{release} +Obsoletes: python3-nvme < 1.0~rc7 +%{?python_provide:%python_provide python3-libnvme} -%description -n python3-nvme +%description -n python3-libnvme This package contains Python bindings for libnvme. %prep @@ -81,11 +87,15 @@ rm -rf %{buildroot}%{_pkgdocdir}/nvme %doc %{_pkgdocdir} %{_mandir}/man2/*.2* -%files -n python3-nvme +%files -n python3-libnvme %dir %{python3_sitearch}/libnvme %{python3_sitearch}/libnvme/* %changelog +* Wed Mar 23 2022 Tomas Bzatek - 1.0~rc7-1 +- Upstream v1.0 Release Candidate 7 +- Renamed python3-nvme subpackage to python3-libnvme + * Mon Mar 14 2022 Tomas Bzatek - 1.0~rc6-1 - Upstream v1.0 Release Candidate 6 diff --git a/nvme_scan_ctrl_1.patch b/nvme_scan_ctrl_1.patch new file mode 100644 index 0000000..5de3e67 --- /dev/null +++ b/nvme_scan_ctrl_1.patch @@ -0,0 +1,31 @@ +commit df80eb6a6357bbaa05dcad3503918745323ad8f1 +Author: Tomas Bzatek +Date: Tue Mar 22 16:22:30 2022 +0100 + + tree: Fix subsystem initialization in nvme_scan_ctrl() + + The subsystem instance would normally get properly initialized + in later stages of topology scanning, unless there's a host + mismatch and the instance would stand alone. + +diff --git a/src/nvme/tree.c b/src/nvme/tree.c +index 96106b0..0764690 100644 +--- a/src/nvme/tree.c ++++ b/src/nvme/tree.c +@@ -1364,10 +1364,13 @@ nvme_ctrl_t nvme_scan_ctrl(nvme_root_t r, const char *name) + subsysname = nvme_ctrl_lookup_subsystem_name(r, name); + /* subsysname might be NULL here */ + s = nvme_lookup_subsystem(h, subsysname, subsysnqn); +- if (subsysname) +- free(subsysname); + free(subsysnqn); +- if (!s) { ++ ++ ret = 0; ++ if (s && !s->name) ++ ret = nvme_init_subsystem(s, subsysname); ++ free(subsysname); ++ if (!s || ret < 0) { + free(path); + errno = ENOMEM; + return NULL; diff --git a/nvme_scan_ctrl_2.patch b/nvme_scan_ctrl_2.patch new file mode 100644 index 0000000..4dcfd3c --- /dev/null +++ b/nvme_scan_ctrl_2.patch @@ -0,0 +1,23 @@ +commit 01ffcb46259205fe4a9b49aecc8888253dfbf7a2 +Author: Tomas Bzatek +Date: Wed Mar 23 13:17:02 2022 +0100 + + tree: Handle NULL subsysname in nvme_scan_ctrl() + + As noted couple of lines earlier, the subsysname string might + be NULL. In that case, defer initialization of nvme_subsystem_t + in hope that it would get initialized while scanning subsystems. + +diff --git a/src/nvme/tree.c b/src/nvme/tree.c +index 0764690..5042a8e 100644 +--- a/src/nvme/tree.c ++++ b/src/nvme/tree.c +@@ -1367,7 +1367,7 @@ nvme_ctrl_t nvme_scan_ctrl(nvme_root_t r, const char *name) + free(subsysnqn); + + ret = 0; +- if (s && !s->name) ++ if (s && !s->name && subsysname) + ret = nvme_init_subsystem(s, subsysname); + free(subsysname); + if (!s || ret < 0) { diff --git a/sources b/sources index bc94e43..af410bd 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libnvme-1.0-rc6.tar.gz) = 3193816ebe5f9523d643ce5df30bb5616b534c33885963e50f840789a0ad5f915171b3f2306c6a09415f3b9dada82a12e94b745f5e73364fbd53b509850e3f62 +SHA512 (libnvme-1.0-rc7.tar.gz) = c6185a909fbe9380f207d47c0dd2198c062b8dab1ef75da77db300ba61e6f262f0658518ee89ee710aae9bf342e7d0147ffe8f282f3f352ae386350ccf06a817