Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp503790ybv; Thu, 13 Feb 2020 04:39:10 -0800 (PST) X-Google-Smtp-Source: APXvYqwxWi+jk79feYskBnvMP0e3cCHfiiYo1MddbatyhwtDkKvPNAyD7lV+8k7cXFYrv9wBLYVp X-Received: by 2002:a05:6830:138b:: with SMTP id d11mr12468472otq.38.1581597549932; Thu, 13 Feb 2020 04:39:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581597549; cv=none; d=google.com; s=arc-20160816; b=NRLIIgKx0W7C7itFiRRPKjmrTZyQfLLZhHag2sBow2eC/pRKPDmJbUzvxcsPUGnCMd QT4RELehWm6NM8phAT7wgX39K9dteX32oAdWJCRj8FkEVkWp9hDpDrm6xInGoe0j9nUl WBOIpI4/Kz7waLXCExJREpayWB/oJdZRk0IhITj5io5bVek9s7H9iSkLHrqOmsG6XXv1 S5y5EyT0sF8AzQ+S4NvX8aExW5tMywftMJs2PZaCPV/Q4kdYT4FqBpd2sIPi3m9mIF3k ssDwNEcran2CigPAxgov90bk/6xsz9dEgqmbtiBVMxAQ8itYSh6nqqWVd4jw3ujmbzQ7 uwOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=VGe+2fKen6xML2/m9P9nda0bTYKLE8cStno9LaFZ28M=; b=YPif73L+y7eLIs2MZLmygET71xaupHO1bXkxU1KTTKl4gA6drXvPCCPCVqOQnYcfUS TJt1bpBsupANj10nJDzhA4xzotdC8rNUMrx5PHMOAmD4ZBKuSFI5w4UAvESXHm9WjR6a CXj8cjlAav6dP8t79N64pB9ZeDaaY+dhxKpG2sA8A02auVH8VI6zxQcCeh63uimHHkux yffsVywDS6fUZTX2scpjcnZ6WjRM4Ot6EXvSBDJF70GwYQ3LPc+AXSi7cjj0erzrQbYk g2L/b7l23Yh/BQG6g2bf0tGVLJOdRZQMHMpAdOrIW4rsaYmLqJ1h/kxgTa7GorzT5c3s HJpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1si1146220otg.113.2020.02.13.04.38.56; Thu, 13 Feb 2020 04:39:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729966AbgBMMiT (ORCPT + 99 others); Thu, 13 Feb 2020 07:38:19 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:45190 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729673AbgBMMiT (ORCPT ); Thu, 13 Feb 2020 07:38:19 -0500 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01DCb7Ug155996 for ; Thu, 13 Feb 2020 07:38:18 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y1tn68dbh-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 13 Feb 2020 07:38:17 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Feb 2020 12:38:14 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 13 Feb 2020 12:38:09 -0000 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 01DCc7Oh54329446 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 13 Feb 2020 12:38:07 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A9B6852051; Thu, 13 Feb 2020 12:38:07 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 396B452057; Thu, 13 Feb 2020 12:38:07 +0000 (GMT) From: Halil Pasic To: "Michael S. Tsirkin" , Jason Wang Cc: Halil Pasic , Paolo Bonzini , Stefan Hajnoczi , Jens Axboe , virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, Christian Borntraeger , Viktor Mihajlovski , Cornelia Huck , Ram Pai , Thiago Jung Bauermann , "Lendacky, Thomas" Subject: [PATCH 2/2] virtio-blk: improve virtqueue error to BLK_STS Date: Thu, 13 Feb 2020 13:37:28 +0100 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200213123728.61216-1-pasic@linux.ibm.com> References: <20200213123728.61216-1-pasic@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 20021312-0012-0000-0000-000003867983 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20021312-0013-0000-0000-000021C2FCC4 Message-Id: <20200213123728.61216-3-pasic@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-13_04:2020-02-12,2020-02-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 malwarescore=0 mlxscore=0 impostorscore=0 phishscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 mlxlogscore=842 spamscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002130098 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Let's change the mapping between virtqueue_add errors to BLK_STS statuses, so that -ENOSPC, which indicates virtqueue full is still mapped to BLK_STS_DEV_RESOURCE, but -ENOMEM which indicates non-device specific resource outage is mapped to BLK_STS_RESOURCE. Signed-off-by: Halil Pasic --- See comment about BLK_STS_DEV_RESOURCE in include/linux/blk_types.h --- drivers/block/virtio_blk.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index adfe43f5ffe4..0736248999b0 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c @@ -251,9 +251,14 @@ static blk_status_t virtio_queue_rq(struct blk_mq_hw_ctx *hctx, if (err == -ENOSPC) blk_mq_stop_hw_queue(hctx); spin_unlock_irqrestore(&vblk->vqs[qid].lock, flags); - if (err == -ENOMEM || err == -ENOSPC) + switch (err) { + case -ENOSPC: return BLK_STS_DEV_RESOURCE; - return BLK_STS_IOERR; + case -ENOMEM: + return BLK_STS_RESOURCE; + default: + return BLK_STS_IOERR; + } } if (bd->last && virtqueue_kick_prepare(vblk->vqs[qid].vq)) -- 2.17.1