Bug 511002

Summary: tgtadm segfaults upon "tgtadm --mode connection --op delete"
Product: Red Hat Enterprise Linux 5 Reporter: LINBIT <partner>
Component: scsi-target-utilsAssignee: Mike Christie <mchristi>
Status: CLOSED ERRATA QA Contact: BaseOS QE <qe-baseos-auto>
Severity: high Docs Contact:
Priority: high    
Version: 5.3CC: bdonahue, coughlan, dkovalsk, fnadge, plyons, sghosh, syeghiay
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Previously, targetadmin (tgtadm) failed and the target daemon (tgtd) could not shut down when users attempted to an open connection with ongoing input/output. With this update, tgtadm shuts down the connection or exits gracefully with an error and the target daemon is no more prevented from subsequently being shut down gracefully.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-13 22:57:53 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: 545786    
Attachments:
Description Flags
strace from tgtadm none

Description LINBIT 2009-07-13 07:44:28 UTC
Description of problem:

When attempting to close an open connection to a target which has ongoing I/O, instead of closing down the connection or exiting gracefully with an error, tgtadm segfaults leaving tgtd in an unusable state. The only working resolution appears to be killing tgtd and restarting.

Version-Release number of selected component (if applicable):
scsi-target-utils-0.0-5.20080917snap.el5

How reproducible:
Attempt to remove an existing connection with "tgtadm --mode connection --op delete" while an initiator produces ongoing I/O on the target.

Steps to Reproduce:
1. Create a target and LU.
2. Connect an initiator to the target and start streaming I/O on the LU.
3. Issue "tgtadm --mode connection --op delete --tid=X --sid=Y --cid=Z"
  
Actual results:
tgtadm exits with SIGSEGV. After this, tgtd cannot be shut down gracefully; any invocation of "service tgtd stop" results in an error. The only way to recover from this state is to
1. Kill tgtd with SIGKILL (SIGTERM won't work)
2. Remove the lockfile at /var/lock/subsys/tgtd
3. Restart tgtd with "service tgtd start"

Expected results:
Either tgtadm shuts down the connection gracefully, or it refuses to do so and exits with an error. In either event, tgtd should not be prevented from subsequently being shut down gracefully.

Additional info:
Appears to be fixed in upstream tgt 0.9.7.

Comment 1 LINBIT 2009-07-13 08:34:30 UTC
Created attachment 351443 [details]
strace from tgtadm

Comment 2 LINBIT 2009-07-13 14:55:38 UTC
Changing severity to "high", as it may leave tgtd in an unusable state, thus may severely affect a system hosting an iSCSI target.

Comment 3 Mike Christie 2009-07-23 09:34:37 UTC
I believe this is fixed in the upstream release:
http://stgt.berlios.de/releases/tgt-0.9.7.tar.bz2 
Are you comfortable with trying that out? If not do not worry. I can make a rpm or try to replicate it here.

Comment 4 LINBIT 2009-07-23 12:03:45 UTC
I already have, and it _is_ fixed in 0.9.7.

Comment 8 LINBIT 2009-08-18 12:31:15 UTC
Update: 0.9.8 has been released. Mike, would you mind giving a brief status update on getting this fixed for RHEL?

Comment 9 Mike Christie 2009-08-18 16:15:46 UTC
It will make RHEL 5.5 for sure.

It was too late for 5.4, but we are testing the 0.9.8 release wrt some other bugs we got late, and when that is done I am going to check with management to see if we can do something before 5.5.

Comment 14 Mike Christie 2009-12-07 16:25:11 UTC
Updated rpms are here:
http://people.redhat.com/mchristi/target/tgt/5.5/
I synced up with the current upstream git code per the tgtd maintainer's
suggestion.

Comment 19 Florian Nadge 2011-01-03 15:02:26 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Previously, targetadmin (tgtadm) failed and the target daemon (tgtd) could not shut down when users attempted to an open connection with ongoing input/output. With this update, tgtadm shuts down the connection or exits gracefully with an error and the target daemon is no more prevented from subsequently being shut down gracefully.

Comment 21 errata-xmlrpc 2011-01-13 22:57:53 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0071.html