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 1136405

Summary: tgtd: service fails to stop if backstore device does not answer
Product: Red Hat Enterprise Linux 6 Reporter: Bruno Goncalves <bgoncalv>
Component: scsi-target-utilsAssignee: Andy Grover <agrover>
Status: CLOSED DUPLICATE QA Contact: Bruno Goncalves <bgoncalv>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.6CC: minoura
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-02 17:06:30 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: 1268411    

Description Bruno Goncalves 2014-09-02 13:49:17 UTC
Description of problem:
Could not stop tgtd service when backstore device was having timeout.


Version-Release number of selected component (if applicable):
scsi-target-utils-1.0.24-16.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Use scsi_debug as backstore device
# modprobe scsi_debug scsi_level=1 dev_size_mb=100

# lsscsi
[1:0:0:0]    cd/dvd  TSSTcorp CD-ROM  TS-H192C B504  /dev/sr0 
[7:0:0:0]    disk    Linux    scsi_debug       0004  /dev/sda 

# cat /etc/tgt/targets.conf
default-driver iscsi
<target iqn.2009-10.com.redhat:storage-1>
    write-cache off
    allow-in-use yes
    <direct-store /dev/sda>
    </direct-store>
</target>


2. Start tgtd service
# service tgtd restart

3. Discover iSCSI target
# iscsiadm -m discovery -I default -p 127.0.0.1 -t st

4. Login to target
# iscsiadm -m node -l

5. Set timeout on scsi_debug device
# echo 4 > /sys/bus/pseudo/drivers/scsi_debug/opts
# echo 1 > /sys/bus/pseudo/drivers/scsi_debug/every_nth

6. Try to perform IO using the iSCSI device
# dd if=/dev/sdb of=/dev/null
dd: reading `/dev/sdb': Input/output error
40+0 records in
40+0 records out
20480 bytes (20 kB) copied, 90.5412 s, 0.2 kB/s

6. Logout from iSCSI device
# iscsiadm -m node -u

7. Remove iSCSI discovery information
# iscsiadm -m discoverydb  --portal "127.0.0.1" -t sendtargets -o delete

8. Stop tgtd
# service tgtd stop

Actual results:
# service tgtd stop
Stopping SCSI target daemon: initiators still connected[FAILED]

# service tgtd force-stop
Force-stopping SCSI target daemon: tgtadm: this target is still active
Command:
    tgtadm -C 0 --mode target --op delete --tid=1
exited with code: 22.
tgtadm: invalid request
[FAILED]

# tgtadm --lld  iscsi -m target -o show
Target 1: iqn.2009-10.com.redhat:storage-1
    System information:
        Driver: iscsi
        State: offline
    I_T nexus information:
        I_T nexus: 1
            Initiator: iqn.1994-05.com.redhat:tcp-general
            Connection: 0
                IP Address: 127.0.0.1
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB, Block size: 1
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            Backing store type: null
            Backing store path: None
            Backing store flags: 
        LUN: 1
            Type: disk
            SCSI ID: IET     00010001
            SCSI SN: 8000
            Size: 105 MB, Block size: 512
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            Backing store type: rdwr
            Backing store path: /dev/sda
            Backing store flags: 
    Account information:
    ACL information:

Comment 5 Andy Grover 2015-11-02 17:06:30 UTC

*** This bug has been marked as a duplicate of bug 852532 ***