Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1744669

Summary: [RHEL8]nvme disconnect-all doesn't work when host has pcie nvme
Product: Red Hat Enterprise Linux 8 Reporter: Zhang Yi <yizhan>
Component: nvme-cliAssignee: David Milburn <dmilburn>
Status: CLOSED ERRATA QA Contact: Zhang Yi <yizhan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.1Flags: pm-rhel: mirror+
Target Milestone: rc   
Target Release: 8.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nvme-cli-1.9-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 17:03:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1776957    

Description Zhang Yi 2019-08-22 16:19:43 UTC
This bug was initially created as a copy of Bug #1744668

I am copying this bug because: 



Description of problem:
nvme disconnect-all doesn't work when host has pcie nvme

Version-Release number of selected component (if applicable):
nvme-cli-1.8.1-3.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
[root@rdma-perf-06 ~]$ lsblk
NAME                         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
nvme0n1                      259:0    0   1.5T  0 disk 
sdb                            8:16   0 111.8G  0 disk 
sda                            8:0    0 111.8G  0 disk 
├─sda2                         8:2    0     1G  0 part /boot
├─sda3                         8:3    0 110.6G  0 part 
│ ├─rhel_rdma--perf--06-swap 253:1    0     4G  0 lvm  [SWAP]
│ ├─rhel_rdma--perf--06-home 253:2    0  56.6G  0 lvm  /home
│ └─rhel_rdma--perf--06-root 253:0    0    50G  0 lvm  /
└─sda1                         8:1    0   200M  0 part /boot/efi
[root@rdma-perf-06 ~]$ nvme connect -t rdma -a 172.31.40.125    -s 4420 -n testnqn
[root@rdma-perf-06 ~]$ lsblk
NAME                         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
nvme0n1                      259:0    0   1.5T  0 disk 
sdb                            8:16   0 111.8G  0 disk 
nvme1n1                      259:1    0   250G  0 disk 
sda                            8:0    0 111.8G  0 disk 
├─sda2                         8:2    0     1G  0 part /boot
├─sda3                         8:3    0 110.6G  0 part 
│ ├─rhel_rdma--perf--06-swap 253:1    0     4G  0 lvm  [SWAP]
│ ├─rhel_rdma--perf--06-home 253:2    0  56.6G  0 lvm  /home
│ └─rhel_rdma--perf--06-root 253:0    0    50G  0 lvm  /
└─sda1                         8:1    0   200M  0 part /boot/efi
[root@rdma-perf-06 ~]$ nvme disconnect-all
Failed to open /sys/class/nvme/nvme0/delete_controller: No such file or directory
[root@rdma-perf-06 ~]$ lsblk
NAME                         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
nvme0n1                      259:0    0   1.5T  0 disk 
sdb                            8:16   0 111.8G  0 disk 
nvme1n1                      259:1    0   250G  0 disk 
sda                            8:0    0 111.8G  0 disk 
├─sda2                         8:2    0     1G  0 part /boot
├─sda3                         8:3    0 110.6G  0 part 
│ ├─rhel_rdma--perf--06-swap 253:1    0     4G  0 lvm  [SWAP]
│ ├─rhel_rdma--perf--06-home 253:2    0  56.6G  0 lvm  /home
│ └─rhel_rdma--perf--06-root 253:0    0    50G  0 lvm  /
└─sda1                         8:1    0   200M  0 part /boot/efi



Actual results:


Expected results:


Additional info:

Upstream fixed path:

commit 3bfedd3be05c0a443ac93b36105be358de55caf3
Author: Minwoo Im <minwoo.im.dev>
Date:   Thu May 16 10:23:49 2019 -0700

    nvme-cli: don't try to disconnect for ctrl with pcie transport
    
    If a host system has both pcie and fabrics controllers, the following
    nvme-cli disconnect-all command will might not be working because
    contrlller with pcie transport does not have delete_controller in sysfs.
    
    root@target:~# nvme list
    Node             SN                   Model                                    Namespace Usage                      Format           FW Rev
    ---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
    /dev/nvme0n1     foo                  QEMU NVMe Ctrl                           1         536.87  MB / 536.87  MB    512   B +  0 B   1.0
    /dev/nvme1n1     b92326b9b2323bf0     Linux                                    1         134.22  MB / 134.22  MB    512   B +  0 B   5.1.0-rc
    /dev/nvme2n1     65fa04eddd9bbac0     Linux                                    1         134.22  MB / 134.22  MB    512   B +  0 B   5.1.0-rc
    
    root@target:~/nvme-cli.git# nvme disconnect-all
    Failed to open /sys/class/nvme/nvme0/delete_controller: No such file or directory
    
    This patch checks the transport type of the controller in iteration.
    
    Reviewed-by: Sagi Grimberg <sagi>
    Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni>
    Signed-off-by: Minwoo Im <minwoo.im.dev>

diff --git a/fabrics.c b/fabrics.c
index 511de06..733a24b 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -1196,6 +1196,8 @@ int disconnect_all(const char *desc, int argc, char **argv)
 
                for (j = 0; j < subsys->nctrls; j++) {
                        struct ctrl_list_item *ctrl = &subsys->ctrls[j];
+                       if (!strcmp(ctrl->transport, "pcie"))
+                               continue;
 
                        ret = disconnect_by_device(ctrl->name);
                        if (ret)

Comment 1 David Milburn 2020-01-14 17:29:19 UTC
Hi Yi,

Would you be able to do a quick test on nvme-cli-1.9-2.TEST.el8.x86_64.rpm?

http://people.redhat.com/dmilburn/.bz1753373_bz1731599.98030607080910702011/

If it works for you please give a qa_ack. Thanks.

Comment 2 Zhang Yi 2020-01-15 07:39:39 UTC
(In reply to David Milburn from comment #1)
> Hi Yi,
> 
> Would you be able to do a quick test on nvme-cli-1.9-2.TEST.el8.x86_64.rpm?
> 
> http://people.redhat.com/dmilburn/.bz1753373_bz1731599.98030607080910702011/
> 
> If it works for you please give a qa_ack. Thanks.

It works.

Thanks
Yi

Comment 3 David Milburn 2020-01-15 17:06:43 UTC
Thanks Yi.

Comment 5 Zhang Yi 2020-01-17 07:54:20 UTC
Verified with nvme-cli-1.9-2.el8.x86_64


[root@rdma-perf-07 ~]$ rpm -qa nvme-cli
nvme-cli-1.9-2.el8.x86_64

[root@rdma-perf-07 ~]$ nvme connect-all -t rdma -a 172.31.0.186 

[root@rdma-perf-07 ~]$ lsblk 
NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda       8:0    0 222.5G  0 disk 
├─sda1    8:1    0   600M  0 part /boot/efi
├─sda2    8:2    0     1G  0 part /boot
├─sda3    8:3    0    45G  0 part /mnt/rdma-ext4
├─sda4    8:4    0    45G  0 part /mnt/rdma-xfs
├─sda5    8:5    0     4G  0 part [SWAP]
└─sda6    8:6    0 126.9G  0 part /
nvme1n1 259:0    0   1.8T  0 disk 
nvme0n1 259:1    0   1.5T  0 disk 
nvme2n1 259:2    0   1.5T  0 disk 

[root@rdma-perf-07 ~]$ nvme disconnect-all
[root@rdma-perf-07 ~]$ lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda       8:0    0 222.5G  0 disk 
├─sda1    8:1    0   600M  0 part /boot/efi
├─sda2    8:2    0     1G  0 part /boot
├─sda3    8:3    0    45G  0 part /mnt/rdma-ext4
├─sda4    8:4    0    45G  0 part /mnt/rdma-xfs
├─sda5    8:5    0     4G  0 part [SWAP]
└─sda6    8:6    0 126.9G  0 part /
nvme1n1 259:0    0   1.8T  0 disk 
nvme0n1 259:1    0   1.5T  0 disk

Comment 7 errata-xmlrpc 2020-04-28 17:03:41 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1915