Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1644420

[PATCH 4.11 002/114] target: Fix compare_and_write_callback handling for non GOOD status

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.11 002/114] target: Fix compare_and_write_callback handling for non GOOD status
Date 2017-05-18 14:20 +0200
Message-ID <tIszn-2pW-9@gated-at.bofh.it> (permalink)
References <tIrai-18m-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.11-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nicholas Bellinger <nab@linux-iscsi.org>

commit a71a5dc7f833943998e97ca8fa6a4c708a0ed1a9 upstream.

Following the bugfix for handling non SAM_STAT_GOOD COMPARE_AND_WRITE
status during COMMIT phase in commit 9b2792c3da1, the same bug exists
for the READ phase as well.

This would manifest first as a lost SCSI response, and eventual
hung task during fabric driver logout or re-login, as existing
shutdown logic waited for the COMPARE_AND_WRITE se_cmd->cmd_kref
to reach zero.

To address this bug, compare_and_write_callback() has been changed
to set post_ret = 1 and return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE
as necessary to signal failure status.

Reported-by: Bill Borsari <wgb@datera.io>
Cc: Bill Borsari <wgb@datera.io>
Tested-by: Gary Guo <ghg@datera.io>
Cc: Gary Guo <ghg@datera.io>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/target/target_core_sbc.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -507,8 +507,11 @@ static sense_reason_t compare_and_write_
 	 * been failed with a non-zero SCSI status.
 	 */
 	if (cmd->scsi_status) {
-		pr_err("compare_and_write_callback: non zero scsi_status:"
+		pr_debug("compare_and_write_callback: non zero scsi_status:"
 			" 0x%02x\n", cmd->scsi_status);
+		*post_ret = 1;
+		if (cmd->scsi_status == SAM_STAT_CHECK_CONDITION)
+			ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 		goto out;
 	}
 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.11 000/114] 4.11.2-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 056/114] ext4: evict inline data when writing to memory map Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 041/114] dm rq: check blk_mq_register_dev() return value in dm_mq_init_request_queue() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 082/114] dax: prevent invalidation of mapped DAX entries Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 087/114] Revert "f2fs: put allocate_segment after refresh_sit_entry" Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 097/114] serial: samsung: Add missing checks for dma_map_single failure Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
    Re: [PATCH 4.11 097/114] serial: samsung: Add missing checks for  dma_map_single failure Krzysztof Kozlowski <krzk@kernel.org> - 2017-05-18 14:20 +0200
      Re: [PATCH 4.11 097/114] serial: samsung: Add missing checks for  dma_map_single failure Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:30 +0200
  [PATCH 4.11 034/114] crypto: algif_aead - Require setkey before accept(2) Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 112/114] pstore: Fix flags to enable dumps on powerpc Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 004/114] iscsi-target: Set session_fall_back_to_erl0 when forcing reinstatement Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 007/114] USB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 102/114] Bluetooth: Fix user channel for 32bit userspace on 64bit kernel Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 047/114] IB/core: For multicast functions, verify that LIDs are multicast LIDs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 057/114] orangefs: fix bounds check for listxattr Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 039/114] dm crypt: rewrite (wipe) key in crypto layer using random data Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 046/114] IB/core: Fix kernel crash during fail to initialize device Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 079/114] md/raid1: avoid reusing a resync bio after error handling. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 052/114] perf auxtrace: Fix no_size logic in addr_filter__resolve_kernel_syms() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 077/114] ovl: do not set overlay.opaque on non-dir create Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 016/114] staging: comedi: jr3_pci: cope with jiffies wraparound Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 085/114] dax: fix PMD data corruption when fault races with write Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 021/114] usb: hub: Do not attempt to autosuspend disconnected devices Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 105/114] cgroup: fix spurious warnings on cgroup_is_dead() from cgroup_sk_alloc() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 023/114] x86/boot: Fix BSS corruption/overwrite bug in early x86 kernel startup Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 067/114] Fix match_prepath() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 055/114] jbd2: fix dbench4 performance regression for nobarrier mounts Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 060/114] orangefs: do not check possibly stale size on truncate Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 13:00 +0200
  [PATCH 4.11 064/114] fs/block_dev: always invalidate cleancache in invalidate_bdev() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 068/114] Do not return number of bytes written for ioctl CIFS_IOC_COPYCHUNK_FILE Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 080/114] device-dax: fix cdev leak Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 103/114] Bluetooth: hci_bcm: add missing tty-device sanity check Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 089/114] f2fs: fix multiple f2fs_add_link() having same name for inline dentry Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 084/114] ext4: return to starting transaction in ext4_dax_huge_fault() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 095/114] fscrypt: avoid collisions when presenting long encrypted filenames Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 081/114] device-dax: fix sysfs attribute deadlock Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 099/114] serial: omap: suspend device on probe errors Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 088/114] f2fs: fix fs corruption due to zero inode page Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 091/114] f2fs: Make flush bios explicitely sync Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 107/114] ipmi: Fix kernel panic at ipmi_ssif_thread() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 111/114] libnvdimm, pfn: fix npfns vs section alignment Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 086/114] f2fs: fix wrong max cost initialization Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 101/114] tty: pl011: use "qdf2400_e44" as the earlycon name for QDF2400 E44 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 108/114] libnvdimm, region: fix flush hint detection crash Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 114/114] pstore: Shut down worker when unregistering Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 094/114] fscrypt: fix context consistency check when key(s) unavailable Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 090/114] f2fs: check entire encrypted bigname when finding a dentry Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 069/114] Set unicode flag on cifs echo request to avoid Mac error Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 073/114] cifs: fix CIFS_ENUMERATE_SNAPSHOTS oops Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 109/114] libnvdimm, pmem: fix a NULL pointer BUG in nd_pmem_notify Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 110/114] libnvdimm: fix nvdimm_bus_lock() vs device_lock() ordering Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 106/114] libata: reject passthrough WRITE SAME requests Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 100/114] tty: pty: Fix ldisc flush after userspace become aware of the data already Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 083/114] mm: fix data corruption due to stale mmap reads Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 098/114] serial: omap: fix runtime-pm handling on unbind Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 092/114] initramfs: Always do fput() and load modules after rootfs populate Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:00 +0200
  [PATCH 4.11 040/114] dm era: save spacemap metadata root after the pre-commit Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 058/114] orangefs: clean up oversize xattr validation Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 033/114] crypto: s5p-sss - Close possible race for completed requests Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 054/114] perf annotate s390: Implement jump types for perf annotate Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 032/114] block: fix blk_integrity_register to use templates interval_exp if not 0 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 038/114] crypto: ccp - Change ISR handler method for a v5 CCP Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 050/114] IB/mlx4: Reduce SRIOV multicast cleanup warning message to debug level Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 078/114] padata: free correct variable Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 015/114] staging: comedi: jr3_pci: fix possible null pointer dereference Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 063/114] fs: fix data invalidation in the cleancache during direct IO Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 018/114] usb: gadget: legacy gadgets are optional Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 061/114] fs/xattr.c: zero out memory copied to userspace in getxattr Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 045/114] IB/core: Fix sysfs registration error flow Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 053/114] perf annotate s390: Fix perf annotate error -95 (4.10 regression) Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 066/114] mm: prevent potential recursive reclaim due to clearing PF_MEMALLOC Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 075/114] cifs: fix CIFS_IOC_GET_MNT_INFO oops Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 043/114] vfio/type1: Remove locked page accounting workqueue Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 065/114] mm: vmscan: fix IO/refault regression in cache workingset transition Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 051/114] IB/hfi1: Prevent kernel QP post send hard lockups Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 036/114] crypto: ccp - Disable interrupts early on unload Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 048/114] IB/IPoIB: ibX: failed to create mcg debug file Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 030/114] KVM: arm/arm64: fix races in kvm_psci_vcpu_on Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 070/114] SMB3: Work around mount failure when using SMB3 dialect to Macs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 035/114] crypto: ccp - Use only the relevant interrupt bits Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 042/114] dm thin: fix a memory leak when passing discard bio down Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 044/114] iov_iter: dont revert iov buffer if csum error Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:10 +0200
  [PATCH 4.11 017/114] usb: misc: add missing continue in switch Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 005/114] usb: xhci: bInterval quirk for TI TUSB73x0 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 003/114] target/fileio: Fix zero-length READ and WRITE handling Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 002/114] target: Fix compare_and_write_callback handling for non GOOD status Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 006/114] usb: host: xhci: print correct command ring address Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 020/114] usb: hub: Fix error loop seen after hub communication errors Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 031/114] arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 008/114] USB: Proper handling of Race Condition when two USB class drivers try to call init_usb_class simultaneously Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 013/114] staging: wilc1000: Fix problem with wrong vif index Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 011/114] staging: vt6656: use off stack for out buffer USB transfers. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 025/114] x86, pmem: Fix cache flushing for iovec write < 8 bytes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 022/114] usb: misc: legousbtower: Fix buffers on stack Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 024/114] selftests/x86/ldt_gdt_32: Work around a glibc sigaction() bug Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 027/114] perf/x86: Fix Broadwell-EP DRAM RAPL events Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 010/114] staging: vt6656: use off stack for in buffer USB transfers. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 029/114] Revert "KVM: Support vCPU-based gfn->hva cache" Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 014/114] [media] staging: sir: fill in missing fields and fix probe Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  [PATCH 4.11 019/114] usb: Make sure usb/phy/of gets built-in Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 14:20 +0200
  Re: [PATCH 4.11 000/114] 4.11.2-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-05-18 21:50 +0200
    Re: [PATCH 4.11 000/114] 4.11.2-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-18 22:50 +0200
  Re: [PATCH 4.11 000/114] 4.11.2-stable review Guenter Roeck <linux@roeck-us.net> - 2017-05-19 03:20 +0200
    Re: [PATCH 4.11 000/114] 4.11.2-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-05-19 07:40 +0200

csiph-web