From patchwork Tue Apr 17 09:03:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffen Maier X-Patchwork-Id: 10344603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 91EF460548 for ; Tue, 17 Apr 2018 09:04:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 885C428946 for ; Tue, 17 Apr 2018 09:04:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7CD6F2899F; Tue, 17 Apr 2018 09:04:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BC3C28A0D for ; Tue, 17 Apr 2018 09:04:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752800AbeDQJEl (ORCPT ); Tue, 17 Apr 2018 05:04:41 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38042 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752120AbeDQJEY (ORCPT ); Tue, 17 Apr 2018 05:04:24 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3H91bZS083601 for ; Tue, 17 Apr 2018 05:04:23 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hdc7enc8s-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 17 Apr 2018 05:04:23 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 17 Apr 2018 10:04:20 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 17 Apr 2018 10:04:15 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3H94FJM58130586; Tue, 17 Apr 2018 09:04:15 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 84E3D52041; Tue, 17 Apr 2018 08:55:04 +0100 (BST) Received: from localhost.localdomain (unknown [9.152.212.160]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id 2926252043; Tue, 17 Apr 2018 08:55:04 +0100 (BST) From: Steffen Maier To: linux-block@vger.kernel.org Cc: Steffen Maier , linux-scsi@vger.kernel.org, Omar Sandoval , Johannes Thumshirn , Bart Van Assche , Hannes Reinecke , Douglas Gilbert , Damien Le Moal , Christoph Hellwig , Lee Duncan Subject: [PATCH blktests] scsi/004: add regression test for false BLK_STS_OK with non good SAM status Date: Tue, 17 Apr 2018 11:03:37 +0200 X-Mailer: git-send-email 1.7.1 To: linux-block@vger.kernel.org X-TM-AS-GCONF: 00 x-cbid: 18041709-0020-0000-0000-00000412CC18 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041709-0021-0000-0000-000042A70AE2 Message-Id: <1523955817-15790-1-git-send-email-maier@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-17_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804170082 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Steffen Maier Reviewed-by: Johannes Thumshirn --- tests/scsi/004 | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/scsi/004.out | 3 ++ 2 files changed, 62 insertions(+), 0 deletions(-) create mode 100755 tests/scsi/004 create mode 100644 tests/scsi/004.out diff --git a/tests/scsi/004 b/tests/scsi/004 new file mode 100755 index 0000000..4852efc --- /dev/null +++ b/tests/scsi/004 @@ -0,0 +1,59 @@ +#!/bin/bash +# +# Ensure repeated SAM_STAT_TASK_SET_FULL results in EIO on timing out command. +# +# Regression test for commit cbe095e2b584 ("Revert "scsi: core: return +# BLK_STS_OK for DID_OK in __scsi_error_from_host_byte()"") +# +# Found independently of corresponding commit mail threads while +# experimenting with storage mirroring. This test is a storage-independent +# reproducer for the error case I ran into. +# +# Copyright IBM Corp. 2018 +# Author: Steffen Maier +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. common/scsi_debug + +DESCRIPTION="ensure repeated TASK SET FULL results in EIO on timing out command" + +requires() { + _have_scsi_debug +} + +test() { + echo "Running ${TEST_NAME}" + + if ! _init_scsi_debug add_host=1 max_luns=1 statistics=1 every_nth=1; then + return 1 + fi + # every_nth RW with full queue gets SAM_STAT_TASK_SET_FULL + echo 0x800 > /sys/bus/pseudo/drivers/scsi_debug/opts + # delay to reduce response repetition: around 1..10sec depending on HZ + echo 1000 > /sys/bus/pseudo/drivers/scsi_debug/delay + # a single command fills device queue to satisfy 0x800 opts condition + echo 1 > "/sys/block/${SCSI_DEBUG_DEVICES[0]}/device/queue_depth" + dd if="/dev/${SCSI_DEBUG_DEVICES[0]}" iflag=direct of=/dev/null bs=512 count=1 |& grep -o "Input/output error" + # stop injection + echo 0 > /sys/bus/pseudo/drivers/scsi_debug/opts + # dd closing SCSI disk causes implicit TUR also being delayed once + while grep -q -F "in_use_bm BUSY:" "/proc/scsi/scsi_debug/${SCSI_DEBUG_HOSTS[0]}"; do + sleep 1 + done + echo 1 > /sys/bus/pseudo/drivers/scsi_debug/delay + _exit_scsi_debug + + echo "Test complete" +} diff --git a/tests/scsi/004.out b/tests/scsi/004.out new file mode 100644 index 0000000..b1126fb --- /dev/null +++ b/tests/scsi/004.out @@ -0,0 +1,3 @@ +Running scsi/004 +Input/output error +Test complete