Hi Benedikt! No, those commits are unlikely to solve the problem you describe. As far as I remember, connection might remain on session's list (and session remains referenced, etc.) until all its SCSI "tasks" have completed (force-close doesn't change that). The catch is that force-close succeeds and returns immediately. If you're lucky, task(s) affecting the connection refcount will complete eventually (so you just wait and retry, monitoring --op show --mode conn to see when it's worth trying). If there's a connection that just doesn't go away after repeated --op delete --mode conn, then you're unlucky. I've been through a situation where there are tasks that are unable to complete forever: when two or more ABORT_TASK[_SET] management requests affect the same command, which is already in_scsi (submitted to kernel), all requests but the last one are stuck forever. It can't be fixed without either introducing many-to-many relation between SCSI commands and ABORT_TASK requests (I've got an experimental patch for it), or implementing some other change to ABORT_TASK[_SET] handling. By the way, as of the whole force-remove-target thing, I prefer the following: * tgtadm --mode target --op delete --force (should delete a target despite existing connections), * to mitigate the problem with active sessions having active commands, preventing LUN deletion, retry on error message "logical unit is still active". The problem with in_scsi tasks (including ABORT_TASK[_SET] hanging forever) is not solved this way either, but at least we don't have to close each connection separately (I believe that tgt-admin code handling of forced target removal was written before --force support on target deletion was added to tgtd/tgtadm). ________________________________________ От: stgt-owner@xxxxxxxxxxxxxxx <stgt-owner@xxxxxxxxxxxxxxx> от имени Benedikt Fraunhofer <fraunhofer@xxxxxxxxxx> Отправлено: 17 мая 2017 г. 17:30 Кому: stgt@xxxxxxxxxxxxxxx Тема: undeletable targets with connections fixed with last commits? Hello List! do the last commits Avoid session* dangling reference on forced target destroy. and Avoid dangling session reference in login_security_done address the problem of targets that just won't go away? We're running 1.0.63 and quite often have the problem that we can't delete targets and stgt think's there are connections while the connection has already been shut down. Also, those connections seem to pile up. We've some targets with >100 Connections to it while the initiator itself sees only one. :# tgt-admin -v --force --delete iqn.2016-01.net.g:xbbs-szq8:iscsi # Removing target: iqn.2016-01.net.g:xbbs-szq8:iscsi tgtadm -C 0 --op delete --mode conn --tid 27 --sid 1016 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 1012 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 10 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 436 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 1017 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 1013 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 530 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 435 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 1014 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 554 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 1019 --cid 1 tgtadm -C 0 --mode target --op delete --tid=27 tgtadm: this target is still active Command: tgtadm -C 0 --mode target --op delete --tid=27 exited with code: 22. ## trying with force one connection to go away :# tgtadm -C 0 --op delete --mode conn --tid 27 --sid 1016 --cid 1 --force :# tgt-admin -v --force --delete iqn.2016-01.net.g:xbbs-szq8:iscsi # Removing target: iqn.2016-01.net.g:xbbs-szq8:iscsi tgtadm -C 0 --op delete --mode conn --tid 27 --sid 10 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 554 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 1013 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 1016 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 1019 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 1012 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 1014 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 435 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 1017 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 530 --cid 1 tgtadm -C 0 --op delete --mode conn --tid 27 --sid 436 --cid 1 tgtadm -C 0 --mode target --op delete --tid=27 tgtadm: this target is still active Command: tgtadm -C 0 --mode target --op delete --tid=27 exited with code: 22. ##connection still there Offlineing the target, removing initiators (unbind) doesn't change anything. Thx in advance Benedikt -- To unsubscribe from this list: send the line "unsubscribe stgt" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe stgt" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html