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 797079

Summary: iscsiadm delete target portal, doesn't remove session
Product: Red Hat Enterprise Linux 6 Reporter: Bruno Goncalves <bgoncalv>
Component: iscsi-initiator-utilsAssignee: Chris Leech <cleech>
Status: CLOSED NOTABUG QA Contact: Bruno Goncalves <bgoncalv>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3CC: coughlan, fge, mchristi, qcai
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 842978 913047 (view as bug list) Environment:
Last Closed: 2015-03-27 08:51:36 UTC Type: ---
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: 842978, 913047    

Description Bruno Goncalves 2012-02-24 08:27:37 UTC
Description of problem:
When running iscsiadm -m discovery -p "127.0.0.1" -o delete, the target portal is deleted, but the current sessions are not removed.


Version-Release number of selected component (if applicable):
iscsi-initiator-utils-6.2.0.872-34.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. install scsi-target-utils
2. service tgtd restart
3. tgtadm --lld iscsi --op new --mode target --tid 1 -T
iqn.1994-05.com.redhat:tgtd-1
4. tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
5. Create disk for LUN: mktemp /tmp/disk.XXXXX
        dd if=/dev/zero of=/tmp/disk.XXXXX bs=1M count=0 seek=100
6. tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b
/tmp/disk.XXXXX

7.iscsiadm -m discovery -t st -p "127.0.0.1" -I default -P1
8. iscsiadm -m node -l
9. iscsiadm -m discovery -p "127.0.0.1" -o delete
10.iscsiadm -m session
tcp: [124] 127.0.0.1:3260,1 iqn.1994-05.com.redhat:tgtd-1

11. iscsiadm -m session --sid 124
iscsiadm: No records found
12. iscsiadm -m node -p 127.0.0.1 --logout
Logging out of session [sid: 124, target: iqn.1994-05.com.redhat:tgtd-1,
portal: 127.0.0.1,3260]
Logout of [sid: 124, target: iqn.1994-05.com.redhat:tgtd-1, portal:
127.0.0.1,3260] successful.

Actual results:
Target portal deleted, but session exists.

Expected results:
I'd expect an error when trying to delete the portal when there is still sessions like that:
iscsiadm -m node -T iqn.1994-05.com.redhat:tgtd-1 -o delete
iscsiadm: This command will remove the record [iface: default, target: iqn.1994-05.com.redhat:tgtd-1, portal: 127.0.0.1,3260], but a session is using it. Logout session then rerun command to remove record.
iscsiadm: Could not execute operation on all records: session exists


Or the sessions would also be removed.

Comment 1 Mike Christie 2012-03-22 09:43:21 UTC
I am going to move this to 6.4. Not enough time for 6.3.

Comment 3 RHEL Program Management 2012-07-10 08:44:36 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 4 RHEL Program Management 2012-07-10 23:31:22 UTC
This request was erroneously removed from consideration in Red Hat Enterprise Linux 6.4, which is currently under development.  This request will be evaluated for inclusion in Red Hat Enterprise Linux 6.4.

Comment 7 RHEL Program Management 2013-10-14 05:05:50 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 8 Bruno Goncalves 2015-03-27 08:51:36 UTC
Closing it as not a bug, it seems to be desirable behavior of iscsiadm.