From patchwork Mon Jan 29 23:35:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 10191097 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 1BF0960388 for ; Mon, 29 Jan 2018 23:36:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0780B28560 for ; Mon, 29 Jan 2018 23:36:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F07832857F; Mon, 29 Jan 2018 23:36:34 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham 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 E232D28560 for ; Mon, 29 Jan 2018 23:36:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751787AbeA2Xgd (ORCPT ); Mon, 29 Jan 2018 18:36:33 -0500 Received: from smtp.nue.novell.com ([195.135.221.5]:53539 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751778AbeA2Xgd (ORCPT ); Mon, 29 Jan 2018 18:36:33 -0500 Received: from emea4-mta.ukb.novell.com ([10.120.13.87]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Tue, 30 Jan 2018 00:36:30 +0100 Received: from apollon.suse.de.de (nwb-a10-snat.microfocus.com [10.120.13.202]) by emea4-mta.ukb.novell.com with ESMTP (TLS encrypted); Mon, 29 Jan 2018 23:36:15 +0000 From: Martin Wilck To: "Martin K. Petersen" , Douglas Gilbert , Hannes Reinecke Cc: James Bottomley , linux-scsi@vger.kernel.org Subject: [PATCH 2/2] scsi_debug: reset injection flags for every_nth > 0 Date: Tue, 30 Jan 2018 00:35:52 +0100 Message-Id: <20180129233552.26702-2-mwilck@suse.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129233552.26702-1-mwilck@suse.com> References: <20180129233552.26702-1-mwilck@suse.com> 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 If every_nth > 0, the injection flags must be reset for commands that aren't supposed to fail (i.e. that aren't "nth"). Otherwise, commands will continue to fail, like in the every_nth < 0 case. Signed-off-by: Martin Wilck --- drivers/scsi/scsi_debug.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 86c48797381e..820b98853e69 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -3988,8 +3988,13 @@ static void clear_queue_stats(void) static void setup_inject(struct sdebug_queue *sqp, struct sdebug_queued_cmd *sqcp) { - if ((atomic_read(&sdebug_cmnd_count) % abs(sdebug_every_nth)) > 0) + if ((atomic_read(&sdebug_cmnd_count) % abs(sdebug_every_nth)) > 0) { + if (sdebug_every_nth > 0) + sqcp->inj_recovered = sqcp->inj_transport + = sqcp->inj_dif + = sqcp->inj_dix = sqcp->inj_short = 0; return; + } sqcp->inj_recovered = !!(SDEBUG_OPT_RECOVERED_ERR & sdebug_opts); sqcp->inj_transport = !!(SDEBUG_OPT_TRANSPORT_ERR & sdebug_opts); sqcp->inj_dif = !!(SDEBUG_OPT_DIF_ERR & sdebug_opts);