From patchwork Fri Dec 10 14:16:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Zhang X-Patchwork-Id: 12669657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D192C433EF for ; Fri, 10 Dec 2021 14:18:17 +0000 (UTC) Received: from localhost ([::1]:37666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mvgj2-0006zj-0n for qemu-devel@archiver.kernel.org; Fri, 10 Dec 2021 09:18:16 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvghf-0005Mq-Cp; Fri, 10 Dec 2021 09:16:51 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:42568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvghd-0000Kc-Jd; Fri, 10 Dec 2021 09:16:51 -0500 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1BAE8c0r002176; Fri, 10 Dec 2021 14:16:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2021-07-09; bh=I/4dMSab+XqI/+j/41gDMw2Rt3KOIpLYnXYJ5JR3NVY=; b=m7O4rl22Qk8nQHamV68KGc3S6nR4c7pokYQs0ygF3fyI3Rbuma/29o2LfEmSNIWnq3Zg lHk8CUI3Sgj08fcKEPLUxd2HNfWfjpUaU4VuA/vwsTUCGWECW952mHVwwn4oucrp3H5j HSxsLRJ5aMH9wgnnOj9sqzfsGMJ4Jl7ygdu2CX5dekDCP5TKwa9/+bfjxv4r5ms4MrDF gMQECkfZWADvMutwhHbZvbqkRAmCUdQFfgTS5nqj0wiPlvyYJoG3LRu2PibHBTFHYLSF iSOiL/9dlpAKLoRNXepm9fLlDpeJ2hBMcKPNy82a08q7NTbounHmPDYYNs7DAZoX5WJQ 8Q== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3ctrj2xe05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 Dec 2021 14:16:36 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 1BAEFafW049225; Fri, 10 Dec 2021 14:16:35 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2104.outbound.protection.outlook.com [104.47.70.104]) by aserp3030.oracle.com with ESMTP id 3csc4xrju9-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 Dec 2021 14:16:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PnHXUDWDKW4xAShph0NhYeSSK9SjW6TobAQdEMf7Xx8/T8gaR3ijkkYtelXQs3K0OS26fImctIz8m+sKvkik23IL4lsDVEPLyVdaJQEQ5JkZLvB5NKTeBN/wUk6NJfMVAUU3BKB+n9I2ZBcAy2ZVagmh8LJvopPixa20eoS0Lz8iUii9mWUklUEJY+O52TksazijcdyT5o1May1lnVtFGy7jXSF+2oqbvYBO5nu07lkKtbDTfEqb+Ozjdy5Zh+S6hrI6UxaJE1odTHjy7mcmxZK4PgfDz6nGMLkYbOJM5QQXwBhcgaZNX4yd135rWeXipo4SmAhu8y6cky7ep/1/Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=I/4dMSab+XqI/+j/41gDMw2Rt3KOIpLYnXYJ5JR3NVY=; b=DrveSG7UzQnhslWpwt3yD10NWUMHjKbIwa4agxfZXfnawiEfoeEPN58Wv1xHA9BQWcaTgvTI8psKG1C2V8+G4UJtRyZqTWsUhG6hTGclKjW7ahKU0ecd/YyHrOjFDHazFEqOKY8Y4zLsDveaN4Ql0gqre7t85g0LUZb8dm4+L30CwG/nb6qkKZ6K6dAccAWvW6QKgqe2CdV16bQ9KNAdBMN2hGYdDYgkUsMsq3kcFvtBN2jQBPkwSv8mZ3Qb1+8HOImpphwMm5z9J7Q6pNpgG/37BH8wz7QNoBS4l3+ethDvsz3A81korsi+8WTcAeP98evYnsYkevREuI1Iq3pMvw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I/4dMSab+XqI/+j/41gDMw2Rt3KOIpLYnXYJ5JR3NVY=; b=jlA2ziy321FXrx6O6+VDEDEiV+QHFZsKgg3Az0u7TuthsSmKWu8nnHNBV30FPzny0LRU4CSmpmhgf1F1Hxh23DaJ1t+RR8Xmjo4dis2ERELy/nGjJ2y5XIk8Q2ks9j9v/3rdj23quFyQyZctEO1fAtr2gmPplma3+jqAdvyFumg= Received: from BYAPR10MB2663.namprd10.prod.outlook.com (2603:10b6:a02:a9::20) by SJ0PR10MB4463.namprd10.prod.outlook.com (2603:10b6:a03:2af::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.25; Fri, 10 Dec 2021 14:16:34 +0000 Received: from BYAPR10MB2663.namprd10.prod.outlook.com ([fe80::91ce:8d4f:e5d1:c67b]) by BYAPR10MB2663.namprd10.prod.outlook.com ([fe80::91ce:8d4f:e5d1:c67b%6]) with mapi id 15.20.4778.015; Fri, 10 Dec 2021 14:16:34 +0000 From: Dongli Zhang To: qemu-block@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 1/2] scsi/scsi_bus: use host_status as parameter for scsi_sense_from_host_status() Date: Fri, 10 Dec 2021 06:16:14 -0800 Message-Id: <20211210141615.2585-2-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211210141615.2585-1-dongli.zhang@oracle.com> References: <20211210141615.2585-1-dongli.zhang@oracle.com> X-ClientProxiedBy: SN7PR04CA0072.namprd04.prod.outlook.com (2603:10b6:806:121::17) To BYAPR10MB2663.namprd10.prod.outlook.com (2603:10b6:a02:a9::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e27b9b49-1192-4611-0b7a-08d9bbe7abcb X-MS-TrafficTypeDiagnostic: SJ0PR10MB4463:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PBnUXOdsN6AZzzY65UID6v1Y9RNPnuv6nDzIwXe6V1SmubGVlYBopV6Nhjv26wdEDpGcK1o5ErxZyC9jaFkR9Bw3Nozpg/jO5PhSsArGVS8RqY/jOcGaIcafCH3bPzb8R1dpxhxFSnSwiseq4mkCpYMKBcbTJonD19Q1irxCHxg6jTYxUphywiRUvLySUyFkMyGJA8qH0F4fOzVaztrqMC9m3JYhsXMJ5aEoSULIvnkVpoZoYkpKTlHW7F1qRvFsvYqjoBCh038iXFYqIRkbWmz2Ecm4ICuf0xu8gLoU7iCC49zDMNoyMBCBGf+xY+UMh+LPNwH9LHVpRr3o2qVbb4VDroPK37hUMPPRIt5OyudIxuhWtNVmHBlbCSpRUhIE9aHIEtnGPJ73UYMrUjIgDnd+XLv5Y3ILWeMA1JvtjObfQ24t0V/vr6UTa79opRjFpMmnmQKh5ttrxpWJ+2bgXpIpOuTegwaqNTMF5axfvQpk2Ao+8AZlm9Ep5nb/o6aUNUxvLDg12wibXemS71mGnj3senEV4xc6GBDdphnWpAAmp9YXIowrsr8i7XjK7ups4XLouI8RfWoUNu0370vDG5BGqyVYTo4PnmDof6J4T+5ZOELoJl0Jz1u3MEMMPlJSQgNaJD12sX7QbKo48QVKwbzxugyY4i7FCd0xJovP3zZ4cP0PIT2AnK6syNftGycellwAnU2LSW1CmDGeP0bGeA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB2663.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(2906002)(6666004)(6506007)(36756003)(26005)(2616005)(4326008)(508600001)(107886003)(186003)(52116002)(44832011)(6486002)(38100700002)(1076003)(316002)(8676002)(8936002)(66556008)(66476007)(4744005)(5660300002)(86362001)(66946007)(38350700002)(6512007)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gueXCvx49eiq4Bd5vg4UCkMUsU25WX818jzBbqerBFAKIfSYoOdIwzFgN0GcM4z8UaLUROVeTzRE8w6QpgQc3fqCm4IdjPF62Pcbzkl/uochJKuWBWydXjwVUYWrX5JP/+ERYy/i4p7gPBV/q9vZ6qIRJpsaBNjp8Rs9kWS94dIj1X0Db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bLtfkVPmthrvuG5b54jvxPz+B7W/TsVvMQ1nVUjurTyQlP9huuN7M3zmSXSoj2p1uVJfX1GuUfqbiNe6/t8LRZF7MNgPuk/5Y7K5vstC6fk3DEhZQ8ZdenuOC2HSqTd43gWYaXQoUuUOct2RsTXOI/M8IzkcNS6pJK6pxDFEZC55XimEOcgISJ9OzWSjpihINfUPjcusg9gON1IoNhjMS7rxp5pes3RNLp+IsnBEoahYIeE+i7JZ6d0fzBdYhXo0B63qAZ6zyOqDELk/h/15u4C7o8kA7Nez54o35PyVh7ihOij8LQTm35kvYyz71VO779G0+ikLrDd3yQVwQ2wLkt9zTID1lxYI+vqJUdt/sTHLN3L71UU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e27b9b49-1192-4611-0b7a-08d9bbe7abcb X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB2663.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2021 14:16:34.5560 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QKOn2OIO7qdblZ46+BwwsKQOGopwSbHK5v9/NQjscHrykPui8xttJOrNlpfIwpWL+WiK+1ihiARQJtj412BxPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4463 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10193 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112100082 X-Proofpoint-ORIG-GUID: L8P1xAotmmwmPVvRtB3qzV65lFixjLG- X-Proofpoint-GUID: L8P1xAotmmwmPVvRtB3qzV65lFixjLG- Received-SPF: pass client-ip=205.220.177.32; envelope-from=dongli.zhang@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, pbonzini@redhat.com, rui.loura@oracle.com, joe.jin@oracle.com, adnan.misherfi@oracle.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" The scsi_sense_from_host_status() always returns GOOD since req->host_status is 255 (-1) at this time. Change req->host_status to host_status so that scsi_sense_from_host_status() will be able to return the expected value. Fixes: f3126d65b393("scsi: move host_status handling into SCSI drivers") Cc: Joe Jin Signed-off-by: Dongli Zhang --- hw/scsi/scsi-bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 77325d8cc7..d46650bd8c 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -1465,7 +1465,7 @@ void scsi_req_complete_failed(SCSIRequest *req, int host_status) assert(req->ops != &reqops_unit_attention); if (!req->bus->info->fail) { - status = scsi_sense_from_host_status(req->host_status, &sense); + status = scsi_sense_from_host_status(host_status, &sense); if (status == CHECK_CONDITION) { scsi_req_build_sense(req, sense); } From patchwork Fri Dec 10 14:16:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Zhang X-Patchwork-Id: 12669683 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1B3B8C433EF for ; Fri, 10 Dec 2021 14:21:05 +0000 (UTC) Received: from localhost ([::1]:42400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mvglk-0001sl-6T for qemu-devel@archiver.kernel.org; Fri, 10 Dec 2021 09:21:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44282) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvghe-0005M3-H2; Fri, 10 Dec 2021 09:16:50 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:47130) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mvghc-0000KP-BW; Fri, 10 Dec 2021 09:16:50 -0500 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1BAE8xvI026532; Fri, 10 Dec 2021 14:16:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : mime-version; s=corp-2021-07-09; bh=kuWFkhshg/ALlM4BUi4berUgxBFfAyyY7PTCowoK2WM=; b=npg08kUU9dYc80qvT3kJEjzc7nrbQ11R8ZqTMBtAjnOCGoI/JpgOGI4BMs4HapVsJxJl RxLhDKlM4JG5teqddgFGM59FC++maRlKyVvdEHOT1II2WS+l2W2nZAMXaVWSYUOnBrKj Qg6jQtjK+7n7ho7x4rtgOc0sU1hnhxc2gCrpASas6ms1+kT2WQCauGu8waaGoy1o++Xr m6CPlsnXyC/vDqyzGe9QAZ8QLj1+NUqtHcuw1t3AJCepU+R3GcD49Hn2We4bTxR+WVwa nwn0QK5DAgbH0QijCA2ZAmgdtc3z8N7iOQqbBPjSziGFQeiuncfyTNeH5J8RmES3iie0 Jw== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3ctse1p5st-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 Dec 2021 14:16:38 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 1BAEGI9H084639; Fri, 10 Dec 2021 14:16:38 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by aserp3020.oracle.com with ESMTP id 3cr059bf06-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 10 Dec 2021 14:16:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EF3yKHC37AdTgczZjQT+YuFM6v2uMrigwX2lTy4eP+CWFMUuSxu+a170J5/vJeLZfMxxnDMgsvRw+bwuD+AZo99X15+9cHFY1kkTrfi0uekqBD3iqYKWvAvlUL5UmU/rA/zHzklQWO+bqw9R6yg7zs137MMLPuoxYcVIaOLUbQgTYMC4+WOfZxAuGq2UcGiFKFV5OOxAx9ryKp4NlgsDmrmlerC1xTkasrLjmxgGNv7OsrQSBxMY7she/FOC7PPHFNKF0i+pW03AkDvdKSiAAoY4g1FM8Kj/spLnJhEfZHV/ge+YNngsphYIYZR4U2Se7EBk8xax93lPDTWVEhn6kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kuWFkhshg/ALlM4BUi4berUgxBFfAyyY7PTCowoK2WM=; b=oTFonJHtog2u+EKF38LdejAjPrRHshx1MB/yC4N+mLmKPTJA++H5DhPmoZ4vx+CHwDPAeYbRJgWEkK3EDWp0kmSVD9XKEJoXXtyfR8dm2zheC9G3QJMSbKygkZJj+1GbIWrBhfFcK8tvQSfBM+HXMiGauURyXsf0rxXMInp4KvaRUKu/vpbhAXYKAeLGlBnZVSgEE2xrg1mUQIqQeqWX3CiSz1k74BWjlrueZV2UMhiYPmchXhfnsKIqrROAvAbwNcTTgdUYarPLz486b8vrV32i964m2pEhy/vdg4Jhv79q7fsYHKiFG5kJUCf8zta5azCoNKJA7TmW/TTmCcm+JQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kuWFkhshg/ALlM4BUi4berUgxBFfAyyY7PTCowoK2WM=; b=AXpZ8za2k7nfMSEIOjOcfv3NcIvMezeE0wLBlR3GTYSUvp1Rl0iW5bDzfHNb43T34wbZATqUURM+aCCL5BYgqae80hkhsCH1L+R0+pQbk9wIXP24qK9s+/MfnfEQecH+5wQmAOdQG9KoEccRyHoyfEiURxPO4pXI8EwOTCk5bqU= Received: from BYAPR10MB2663.namprd10.prod.outlook.com (2603:10b6:a02:a9::20) by SJ0PR10MB4463.namprd10.prod.outlook.com (2603:10b6:a03:2af::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4755.25; Fri, 10 Dec 2021 14:16:36 +0000 Received: from BYAPR10MB2663.namprd10.prod.outlook.com ([fe80::91ce:8d4f:e5d1:c67b]) by BYAPR10MB2663.namprd10.prod.outlook.com ([fe80::91ce:8d4f:e5d1:c67b%6]) with mapi id 15.20.4778.015; Fri, 10 Dec 2021 14:16:36 +0000 From: Dongli Zhang To: qemu-block@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 2/2] scsi/utils: pass host_status = SCSI_HOST_ERROR to guest kernel Date: Fri, 10 Dec 2021 06:16:15 -0800 Message-Id: <20211210141615.2585-3-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211210141615.2585-1-dongli.zhang@oracle.com> References: <20211210141615.2585-1-dongli.zhang@oracle.com> X-ClientProxiedBy: SN7PR04CA0072.namprd04.prod.outlook.com (2603:10b6:806:121::17) To BYAPR10MB2663.namprd10.prod.outlook.com (2603:10b6:a02:a9::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 65230e0f-f061-458c-4b73-08d9bbe7acb2 X-MS-TrafficTypeDiagnostic: SJ0PR10MB4463:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g97u6YWJZupjaXKTevxF05RgkcxnZNDyvR8+z87SEHG4/YTsHseJKYxrksb4JFGNTYGp+yuJohHTrzyF0RItaXNOWp+IDKqPd2OYFyXV+ZJJeFbuHbpaHo8579sCv2O7q+I+tB9QOoPQ6ms0mi7MfBTmQgV1kPNOjblHYJKvRiyMmb1wjBdwD+ohWENKf2IL/6XZnlV0QOrh3d4unfY2v18bg44kttUR+g+7VsPGI424wn7PAMMhEBvExqA6h5X3pHsTR+8am9EIsovSFv0M8+F3udeduhnqYKfTw0pJ+vuqYOEYHebSRgWPXz+VUFVv+l0ssaeG8xtUVFoayWJpI/ui4kf1GRP8T8Ju6nd+8xTMG/feFzO8pJ/A+1NVf6OEXuDerjmmfCWhC0GumSXdMlMW+JBG0o9uzmZN1U4KkBcn7ftQ7WZhadz8aLR0ii6Q+M0f3OvuqyZb+x700HsRZXLPr2nIHdf/D6fEnvG8uiQd8253NBJ6xjND9SdxTkln/I+IxOLAYY97L1CyoEMS1s6GOIXk1dDAhoFWfbUKOo0fxyEjRMS1I3Rwep6hVDbkdZyfsO0s6gUjIeR5PJQh5+6hOgJZVtXftk5eGpVm766LHTY9opdneAyYoee3DwqAeq1SloBSTucXI3ncGYNFVrMHT2MzgmSgWGxJL+B8PgvMKSD8KsjCBDUQZ7/R9ur2E2R+9XkNaCwa4fuHJPC8zg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB2663.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(2906002)(6666004)(6506007)(36756003)(26005)(2616005)(4326008)(508600001)(107886003)(186003)(52116002)(44832011)(6486002)(38100700002)(1076003)(316002)(8676002)(8936002)(66556008)(66476007)(5660300002)(86362001)(66946007)(38350700002)(6512007)(83380400001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pYPETsK+B3ouUpBkFCBXC8lTyfx7C7KMSwzE6zh6PC1cI6bQlNa9fLHMQ4WZ1LPt8MgnCyEKytjW22DzwCfNXDL0BP8ReeStlqe+OJqAjfDl7ff0QbLhao5Y/HF0Vw8fQzO1pFgZKRTe6to1f+4MiHFniK31md0DbFYZBDUOkA/lJF2v9zgRh+bzaYRi9OFj3qkM1ZzAsHNl8PoHK0Sot5zL4dx4HtTC8ZMR6TvwxKkixUCFQX4R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ptu94YqrOzxtssRiDHgmsIaQuG6MQqhq7u3wDXMdFKzj4x8ITsqZkjCk13ZwXBCOy13ykOCi/dkPR+nk5SDKJt9aDiStg+2EPRG6hgs4vm4USCDXqzVYSrVYYcBBdavaUkUwyqTEsV/UIAltedTOOOMiWLnXFjZ5bFDVJTnTooCg8vHgesxhjP7crN3gE4dPPGiq9/Yq5Nrj4uKW0I1E7Z+SOmmjAALJi7800PB+LoDU8m7IfJ3wNziEUl7X15ivYKesQtW507nWxdGzxeMzFdXvkR1+hX4YothpFEh+8BR8w/lqAQocFAOT0+WGwL4P+mZVCZyESgA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65230e0f-f061-458c-4b73-08d9bbe7acb2 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB2663.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Dec 2021 14:16:36.0872 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ph/m0/hg7RWAurStrYZs5eLj826dUw5I+0EIb3Ni+jjWZPpwfEevEq6i6bdNxicDzMOZ/eRDLMleZMUOPICXqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4463 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10193 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2112100082 X-Proofpoint-GUID: j5l0qqx4dtQc-3Wp4zO9s1r08n5ftu-c X-Proofpoint-ORIG-GUID: j5l0qqx4dtQc-3Wp4zO9s1r08n5ftu-c Received-SPF: pass client-ip=205.220.165.32; envelope-from=dongli.zhang@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, pbonzini@redhat.com, rui.loura@oracle.com, joe.jin@oracle.com, adnan.misherfi@oracle.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" For scsi_req_complete_failed() and when the req->bus->info->fail() is implemented, the virtio-scsi passes SCSI_HOST_ERROR to the guest kernel as VIRTIO_SCSI_S_FAILURE, while the pvscsi passes SCSI_HOST_ERROR to guest kernel as BTSTAT_HASOFTWARE. However, the scsi_req_complete_failed()->scsi_sense_from_host_status() always returns GOOD for SCSI_HOST_ERROR, when the req->bus->info->fail() is not implemented (e.g., megasas). As a result, the sense is not passed to the guest kernel. The SCSI_HOST_ERROR is reproduced on purpose by below QEMU command line: -device megasas,id=vscsi0,bus=pci.0,addr=0x4 \ -drive file=/dev/sdc,format=raw,if=none,id=drive01 \ -device scsi-block,bus=vscsi0.0,channel=0,scsi-id=0,lun=0,drive=drive01 \ ... and when we remove the /dev/sdc from the host with: "echo 1 > /sys/block/sdc/device/delete" This patch passes sense_code_IO_ERROR to the guest kernel for host_status = SCSI_HOST_ERROR. (This issue is detected by running a testing code from Rui Loura). Cc: Joe Jin Cc: Adnan Misherfi Cc: Rui Loura Signed-off-by: Dongli Zhang --- scsi/utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scsi/utils.c b/scsi/utils.c index 357b036671..086a1fea66 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -638,6 +638,9 @@ int scsi_sense_from_host_status(uint8_t host_status, case SCSI_HOST_ABORTED: *sense = SENSE_CODE(COMMAND_ABORTED); return CHECK_CONDITION; + case SCSI_HOST_ERROR: + *sense = SENSE_CODE(IO_ERROR); + return CHECK_CONDITION; case SCSI_HOST_RESET: *sense = SENSE_CODE(RESET); return CHECK_CONDITION;