From 2427bc5b2d932c7484e88dee13cd6dee4e4de8ea Mon Sep 17 00:00:00 2001 From: Maurizio Lombardi Date: Mon, 14 Jun 2021 14:35:47 +0200 Subject: [PATCH] nvme flush failed from from v5.13-rc1 Resolves: #1962422 Signed-off-by: Maurizio Lombardi --- ...fault-flush-to-use-block-device-nsid.patch | 33 +++++++++++++++++++ nvme-cli.spec | 7 +++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 0001-default-flush-to-use-block-device-nsid.patch diff --git a/0001-default-flush-to-use-block-device-nsid.patch b/0001-default-flush-to-use-block-device-nsid.patch new file mode 100644 index 0000000..1505fef --- /dev/null +++ b/0001-default-flush-to-use-block-device-nsid.patch @@ -0,0 +1,33 @@ +From 6abc4f36b38aa6be3c7e4b89e2997e5006e40b37 Mon Sep 17 00:00:00 2001 +From: Keith Busch +Date: Tue, 1 Jun 2021 07:01:44 -0700 +Subject: [PATCH] default flush to use block device nsid + +Kernel 5.13 added checks to ensure the ioctl path can't be abused to +access a different namespace than the one user space has permission to +open. This unfortunately breaks the all-nsid flush usage, so user +tooling needs to default to the device's namespace id. + +Link: https://lore.kernel.org/linux-nvme/20210518144249.GE2709569@dhcp-10-100-145-180.wdc.com/T/#t +Link: https://github.com/linux-nvme/nvme-cli/issues/1066 +Signed-off-by: Keith Busch +--- + nvme.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/nvme.c b/nvme.c +index 87e1a82..1666ba5 100644 +--- a/nvme.c ++++ b/nvme.c +@@ -4384,7 +4384,7 @@ static int flush(int argc, char **argv, struct command *cmd, struct plugin *plug + }; + + struct config cfg = { +- .namespace_id = NVME_NSID_ALL, ++ .namespace_id = 0, + }; + + OPT_ARGS(opts) = { +-- +2.31.1 + diff --git a/nvme-cli.spec b/nvme-cli.spec index ad23e12..d10fb43 100644 --- a/nvme-cli.spec +++ b/nvme-cli.spec @@ -3,7 +3,7 @@ Name: nvme-cli Version: 1.14 -Release: 1%{?dist} +Release: 2%{?dist} Summary: NVMe management command line interface License: GPLv2+ @@ -11,6 +11,7 @@ URL: https://github.com/linux-nvme/nvme-cli Source0: https://github.com/linux-nvme/%{name}/archive/v%{version}.tar.gz Patch0: nvme-cli-makefile-dont-install-host-params-patch +Patch1: 0001-default-flush-to-use-block-device-nsid.patch BuildRequires: libuuid-devel BuildRequires: gcc @@ -24,6 +25,7 @@ nvme-cli provides NVM-Express user space tooling for Linux. #%%setup -qn %%{name}-%%{commit0} %setup -q %patch0 -p1 +%patch1 -p1 %build @@ -81,6 +83,9 @@ if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then fi %changelog +* Mon Jun 14 2021 Maurizio Lombardi - 1.14-2 +- Fix for bz1962422 (nvme flush failed from from v5.13-rc1) + * Mon May 03 2021 Maurizio Lombardi - 1.14-1 - Update to the latest upstream version