From patchwork Thu Aug 8 20:05:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 11084681 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0466D13B1 for ; Thu, 8 Aug 2019 20:05:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED1BA28B0A for ; Thu, 8 Aug 2019 20:05:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0EF428B85; Thu, 8 Aug 2019 20:05:17 +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=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 80B8F28B0A for ; Thu, 8 Aug 2019 20:05:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390169AbfHHUFQ (ORCPT ); Thu, 8 Aug 2019 16:05:16 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:42968 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732704AbfHHUFQ (ORCPT ); Thu, 8 Aug 2019 16:05:16 -0400 Received: by mail-pl1-f193.google.com with SMTP id ay6so44026941plb.9 for ; Thu, 08 Aug 2019 13:05:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PLkRSmrn41W++1njDG0plghfflSWM76SF0ZekFVoOoA=; b=W0lTbLI9Abn7VdmuXgk+9pdVsxLjcKJKgbhjaDGSjS18N3A7m191efUCrZsmo51MKr 4gqa3pCNuN2LQGpt5YfbAs8SD/HsNRqUxaKvXga3/RzVIOMQZDdNd6+ymTZqO034XWfp uQFWK4JvEjUfusedJnlAMlDvaElbi5PEkizV+iI+Kik3JGPnNMvNosm8xv1NW2A5lhQK 1jrhe2AhIoMOUfWaVk+fxo0m1Y4QAEKq2TQxNngYFcZBQVw3S3pCHwIxlLxVrEXXNdke pWq8b1RWxuh4v56zhftH9wsH7nr6863efV/p8ocWVMHAtKMRQmL8WqcovGLJAbCmTmik 9d4Q== X-Gm-Message-State: APjAAAWJrEaAj4VelrdxGdF9hTQg307I4FYI1EsmsFreEDvEIbzTq+PJ 8aQMj1+GYoG8PMOPFmrCB68= X-Google-Smtp-Source: APXvYqyT0ujooYRUe+4LgLRsVNwnzlmU63fgIXwRMfSXaZAEsU0z9kYLgkgB85WG6kOfxb3gMKxNTQ== X-Received: by 2002:a17:902:2bc5:: with SMTP id l63mr15950672plb.30.1565294715831; Thu, 08 Aug 2019 13:05:15 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:202:4308:52a3:24b6:2c60]) by smtp.gmail.com with ESMTPSA id b6sm83307093pgq.26.2019.08.08.13.05.14 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 08 Aug 2019 13:05:15 -0700 (PDT) From: Bart Van Assche To: Omar Sandoval Cc: linux-block@vger.kernel.org, Johannes Thumshirn , Logan Gunthorpe , Bart Van Assche Subject: [PATCH blktests 1/4] tests/nvme/rc: Modify the approach for disabling and re-enabling Ctrl-C Date: Thu, 8 Aug 2019 13:05:03 -0700 Message-Id: <20190808200506.186137-2-bvanassche@acm.org> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog In-Reply-To: <20190808200506.186137-1-bvanassche@acm.org> References: <20190808200506.186137-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid that the following error messages are reported when redirecting stdin: stty: 'standard input': Inappropriate ioctl for device stty: 'standard input': Inappropriate ioctl for device Cc: Logan Gunthorpe Cc: Johannes Thumshirn Fixes: a987b10bc179 ("nvme: Ensure all ports and subsystems are removed on cleanup") Signed-off-by: Bart Van Assche Reviewed-by: Logan Gunthorpe --- tests/nvme/rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/nvme/rc b/tests/nvme/rc index d4e18e635dea..40f0413d32d2 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -36,7 +36,7 @@ _cleanup_nvmet() { fi # Don't let successive Ctrl-Cs interrupt the cleanup processes - stty -isig + trap '' SIGINT shopt -s nullglob @@ -66,7 +66,7 @@ _cleanup_nvmet() { done shopt -u nullglob - stty isig + trap SIGINT modprobe -r nvme-loop 2>/dev/null modprobe -r nvmet 2>/dev/null From patchwork Thu Aug 8 20:05:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 11084683 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DEF1C13B1 for ; Thu, 8 Aug 2019 20:05:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D278828B0A for ; Thu, 8 Aug 2019 20:05:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6A4028B85; Thu, 8 Aug 2019 20:05:18 +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=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 6653228B0A for ; Thu, 8 Aug 2019 20:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403831AbfHHUFR (ORCPT ); Thu, 8 Aug 2019 16:05:17 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35325 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732704AbfHHUFR (ORCPT ); Thu, 8 Aug 2019 16:05:17 -0400 Received: by mail-pg1-f195.google.com with SMTP id n4so2880993pgv.2 for ; Thu, 08 Aug 2019 13:05:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GPuTl/pW34NW20Oqtx9tQBNVNvCI52BUN4vQW8QKfe8=; b=m0HumNMSSfaQsHjIy/Q/tIYMiqu5H0pkTr33uXaKBdhBpXryKSHYH+CrED0mCuLxNq thKDC4dIi51PnyBIs7S35LZGBYiN6QLU7ls+8ZAHvSndM8cLgDHvam0u5FjNCN07+3kD wzeSxCJ1uqzXihgwoZyNVFMpWc9S1VBt9jmpr4P1gnTU2DnjHFJrCwG6dlST8seiB3uS N8qjRl+jFIqutktnEybzcjyNFQb3ySYDLCrw/4cfQPFTOHYw4NuEXV8qx+feqOCMP8rB wi+PjilI+r5CSwF0AyIbWUG7QnMAqk1oREuRTxypImnaizjWS/PSPwEhq68QNoAp4VKV pf6A== X-Gm-Message-State: APjAAAUhwthSm0BXrOZaDL1yAu4r0YgjsuxYY3aUQ+V5G1Yt1Ulp+Ju+ EoSpza5QCD/Ri1TLuI8NRfE= X-Google-Smtp-Source: APXvYqwDTToc8YPZsieK/CnPh5VpdG+EXBZiBHWil6OnD6kpTcuhYrkJ1SkYrZ+1NnE5smmFxaLslw== X-Received: by 2002:a17:90a:228b:: with SMTP id s11mr5609801pjc.23.1565294716938; Thu, 08 Aug 2019 13:05:16 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:202:4308:52a3:24b6:2c60]) by smtp.gmail.com with ESMTPSA id b6sm83307093pgq.26.2019.08.08.13.05.15 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 08 Aug 2019 13:05:16 -0700 (PDT) From: Bart Van Assche To: Omar Sandoval Cc: linux-block@vger.kernel.org, Johannes Thumshirn , Logan Gunthorpe , Bart Van Assche Subject: [PATCH blktests 2/4] tests/nvmeof-mp/rc: Make simulate_network_failure_loop() more robust Date: Thu, 8 Aug 2019 13:05:04 -0700 Message-Id: <20190808200506.186137-3-bvanassche@acm.org> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog In-Reply-To: <20190808200506.186137-1-bvanassche@acm.org> References: <20190808200506.186137-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid that the following is logged in the nvmeof-mp .full log files: ls: cannot access '/sys/class/nvme/*/device/*/nvme0n1/reset_controller': No such file or directory tests/nvmeof-mp/rc: line 124: : No such file or directory Signed-off-by: Bart Van Assche --- tests/nvmeof-mp/rc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/nvmeof-mp/rc b/tests/nvmeof-mp/rc index 9324dd1e8e4f..7352b1628cd3 100755 --- a/tests/nvmeof-mp/rc +++ b/tests/nvmeof-mp/rc @@ -117,8 +117,9 @@ simulate_network_failure_loop() { while [ $rc = 0 ]; do sleep_until 5 ${deadline} || break for d in $(held_by "$dev"); do - sf=$(ls -d /sys/class/nvme/*/device/*/"${d#/dev/}/reset_controller") - echo 1 > "$sf" + for sf in /sys/class/nvme/*/device/*/"${d#/dev/}/reset_controller"; do + [ -e "$sf" ] && echo 1 > "$sf" + done done done 2>>"$FULL" From patchwork Thu Aug 8 20:05:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 11084685 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F0901399 for ; Thu, 8 Aug 2019 20:05:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3346C28B0A for ; Thu, 8 Aug 2019 20:05:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2731828B85; Thu, 8 Aug 2019 20:05:21 +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=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 CCB8C28B0A for ; Thu, 8 Aug 2019 20:05:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404055AbfHHUFU (ORCPT ); Thu, 8 Aug 2019 16:05:20 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:42972 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732704AbfHHUFU (ORCPT ); Thu, 8 Aug 2019 16:05:20 -0400 Received: by mail-pl1-f193.google.com with SMTP id ay6so44026992plb.9 for ; Thu, 08 Aug 2019 13:05:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aFGSxl9VItZvVMU/SEOzPttnqjIgO4UH7axrM2LnrbY=; b=XCxGKpUh1mZwMZunhIrvLATMyYQYYMfS+wE4uyTG+taW0MjyIINk/9AabvsaYfSFOF oTRshYogI+RqOaGEsxLccuWwqD/c5lM4OhQGr7Oy7mU4TTiro0OureINHyeCgaG0x87q nYw+dB09IAVh43s+H3jj0CcbCl3DS0+uDBejJbw18+6L2QcZHKu8BRDAmMkRjbCYzLUE HXyAnw43cq/huJiOtkA9tvQIQZ/9lruMRq/DRvyqZwtW2gHnlCXKb26tijY+ByuhlH9t nAf39amo1gVvy2A4zC3zL6OYl5mAjJiQDdHsz1Shuz8kO0B9Fg0GJcB8aIvxn5vAj/sS Wriw== X-Gm-Message-State: APjAAAWKVXtZHU9R5CHfKIs4X01pinDnw693cAynEispIr3+OUphwGXa lBOAVvInv/z4gH/9hoo0iHw= X-Google-Smtp-Source: APXvYqxndmd9LitS7xXGPCLHqRWjGo7/WY2f2NGu87RKu26fKeYea7hH7P5Jo/xFtqiVKqH3GTuMmA== X-Received: by 2002:a17:902:b418:: with SMTP id x24mr2900494plr.219.1565294718736; Thu, 08 Aug 2019 13:05:18 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:202:4308:52a3:24b6:2c60]) by smtp.gmail.com with ESMTPSA id b6sm83307093pgq.26.2019.08.08.13.05.16 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 08 Aug 2019 13:05:17 -0700 (PDT) From: Bart Van Assche To: Omar Sandoval Cc: linux-block@vger.kernel.org, Johannes Thumshirn , Logan Gunthorpe , Bart Van Assche Subject: [PATCH blktests 3/4] tests/nvmeof-mp/rc: Make the NVMeOF multipath tests more reliable Date: Thu, 8 Aug 2019 13:05:05 -0700 Message-Id: <20190808200506.186137-4-bvanassche@acm.org> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog In-Reply-To: <20190808200506.186137-1-bvanassche@acm.org> References: <20190808200506.186137-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix the following failure for tests 002, 003, 004 and 011: +tests/nvmeof-mp/rc: line 99: echo: write error: Operation already in progress Signed-off-by: Bart Van Assche --- tests/nvmeof-mp/rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/nvmeof-mp/rc b/tests/nvmeof-mp/rc index 7352b1628cd3..2493fcee12de 100755 --- a/tests/nvmeof-mp/rc +++ b/tests/nvmeof-mp/rc @@ -124,7 +124,7 @@ simulate_network_failure_loop() { done 2>>"$FULL" for ((i=0;i<5;i++)); do - log_in && break + log_in 2>/dev/null && break sleep 1 done } From patchwork Thu Aug 8 20:05:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 11084687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8D701709 for ; Thu, 8 Aug 2019 20:05:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC1F228B0A for ; Thu, 8 Aug 2019 20:05:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C074428B85; Thu, 8 Aug 2019 20:05:21 +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=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 5281428B0A for ; Thu, 8 Aug 2019 20:05:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732704AbfHHUFU (ORCPT ); Thu, 8 Aug 2019 16:05:20 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:36600 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404052AbfHHUFU (ORCPT ); Thu, 8 Aug 2019 16:05:20 -0400 Received: by mail-pl1-f196.google.com with SMTP id k8so43997329plt.3 for ; Thu, 08 Aug 2019 13:05:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H7hl1WyPR2VwzTL5TFVOZS8PC4G/b+Nlw5PBSgVersc=; b=RZzUQhJsmTmI/TJzFRyHlcxMJzWqbVEqAPP0nl6xFQRLSy2OMjIWY3NNy6JLtUGZqV HkVG51+uMKBZr6KFMtyEegloSz3HshkrEphW7awAmzkyxfNOS7vqhtungmVYcLkC+oV6 uOIZyj3lQehDRnj8R6OZzh0dYv26kxtNy4e9SumDf/UDlCLuByomtlB1Lg0GArP/0KXf xx9tt9KcG+0dUZ1RwTdXydC5TSaOwCVTBbHSkSbpBxw/UKIM5cn+5JZQekCGO4MlvcKP RwM61pvu0N+R+smBLTIjgK13RLS28UExeUwyWRfXOIeSpwzXJhBYso74PE64IkGDroxG A4Bw== X-Gm-Message-State: APjAAAU627C3zOO8IvwICYfedyvy9dH+8nm9F67eHZnyIzyFBAJPfR9Y RjRBa6oQTaarJ15nMmtbh7X6bEa3 X-Google-Smtp-Source: APXvYqzxvuqhlu6ro8pjL7k75Af57fh5By1NrcIjFJgC1aHRHp6dfw3jcjuhXSDfltcQFG80JEv/KQ== X-Received: by 2002:a17:902:1e2:: with SMTP id b89mr15893703plb.7.1565294719880; Thu, 08 Aug 2019 13:05:19 -0700 (PDT) Received: from desktop-bart.svl.corp.google.com ([2620:15c:2cd:202:4308:52a3:24b6:2c60]) by smtp.gmail.com with ESMTPSA id b6sm83307093pgq.26.2019.08.08.13.05.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 08 Aug 2019 13:05:19 -0700 (PDT) From: Bart Van Assche To: Omar Sandoval Cc: linux-block@vger.kernel.org, Johannes Thumshirn , Logan Gunthorpe , Bart Van Assche Subject: [PATCH blktests 4/4] tests/srp/014: Add a test that triggers a SCSI reset while I/O is ongoing Date: Thu, 8 Aug 2019 13:05:06 -0700 Message-Id: <20190808200506.186137-5-bvanassche@acm.org> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog In-Reply-To: <20190808200506.186137-1-bvanassche@acm.org> References: <20190808200506.186137-1-bvanassche@acm.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This test triggers the task management function handling code in the SRP initiator and target drivers. Signed-off-by: Bart Van Assche --- tests/srp/014 | 107 ++++++++++++++++++++++++++++++++++++++++++++++ tests/srp/014.out | 2 + 2 files changed, 109 insertions(+) create mode 100755 tests/srp/014 create mode 100644 tests/srp/014.out diff --git a/tests/srp/014 b/tests/srp/014 new file mode 100755 index 000000000000..8ecd8a439a82 --- /dev/null +++ b/tests/srp/014 @@ -0,0 +1,107 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2016-2018 Western Digital Corporation or its affiliates +# +# Submit SCSI resets while a fio --verify job is running. This is a regression +# test for Linux kernel commit fd5614124406 ("scsi: RDMA/srp: Fix a +# sleep-in-invalid-context bug") # v5.3. + +. tests/srp/rc + +DESCRIPTION="Run sg_reset while I/O is ongoing" +TIMED=1 + +# $1: SCSI device of which to change the state to running, e.g. sdc. +make_running() { + local dev=$1 sp state + + for sp in /sys/class/scsi_device/*/device/block/"$dev"; do + if [ -e "$sp" ]; then + break + else + return 1 + fi + done + sp=$(dirname "$(dirname "$sp")")/state + # If the SCSI error handler changed the device state to offline, + # change the state back to running. + state=$(<"$sp") + if [ "$state" = offline ]; then + echo running > "$sp" + echo "$dev: state $state -> running" >>"$FULL" + else + echo "$dev: state $state" >>"$FULL" + fi +} + +# $1: dm device to examine, e.g. +# /dev/disk/by-id/dm-uuid-mpath-360014056e756c6c62300000000000000 +make_all_running() { + local d h dev=$1 + + while [ -L "$dev" ]; do + dev=$(realpath "$dev") + done + dev=${dev#/dev/} + for h in /sys/class/block/*/holders/"$dev"; do + [ -e "$h" ] || continue + d=$(basename "$(dirname "$(dirname "$h")")") + make_running "$d" + done +} + +# $1: dm device to act on. +set_running_loop() { + local dev="$1" + + [ -e "$dev" ] || return $? + while true; do + sleep 1 + make_all_running "$dev" + done + echo "set_running_loop $dev finished" >>"$FULL" +} + +# $1: dm device to reset periodically; $2: how long the reset loop should run. +sg_reset_loop() { + local cmd dev="$1" duration="$2" deadline i=0 reset_type + + [ -e "$dev" ] || return $? + [ -n "$duration" ] || return $? + reset_type=(-d -b) + deadline=$(($(uptime_s) + duration)) + while true; do + sleep_until 1 ${deadline} || break + cmd="sg_reset --no-esc ${reset_type[i++ % 2]} $dev" + { echo "+ $cmd"; eval "$cmd"; } >>"$FULL" 2>&1 + done + echo "sg_reset_loop $dev finished" >>"$FULL" +} + +test_sg_reset() { + local dev fio_status m job + + use_blk_mq y y || return $? + dev=$(get_bdev 0) || return $? + sg_reset_loop "$dev" "$TIMEOUT" & + # Redirect stderr to suppress the bash "Terminated" message. + set_running_loop "$dev" 2>/dev/null & + job=$! + run_fio --verify=md5 --rw=randwrite --bs=64K --loops=$((10**6)) \ + --iodepth=16 --group_reporting --sync=1 --direct=1 \ + --ioengine=libaio --runtime="${TIMEOUT}" \ + --filename="$dev" --name=sg-reset-test --thread --numjobs=1 \ + --output="${RESULTS_DIR}/srp/fio-output-014.txt" \ + >>"$FULL" + fio_status=$? + kill "$job" + make_all_running "$dev" + wait + return $fio_status +} + +test() { + : "${TIMEOUT:=30}" + trap 'trap "" EXIT; teardown' EXIT + setup && test_sg_reset && echo Passed +} diff --git a/tests/srp/014.out b/tests/srp/014.out new file mode 100644 index 000000000000..5e25d8e8672d --- /dev/null +++ b/tests/srp/014.out @@ -0,0 +1,2 @@ +Configured SRP target driver +Passed