From patchwork Thu Nov 8 13:07:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Ivanov X-Patchwork-Id: 994872 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cambridgegreys.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bqX7DIbO"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="BLPM4w1W"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42rNr35zK9z9s55 for ; Fri, 9 Nov 2018 00:08:03 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=D1Wi4sd9XR2daauK1eKQ0ME6z9R1NfrrFTjRq3V009U=; b=bqX 7DIbO7wT2njDGw1TO9i14gTkXALI6NTqDj9ZRJzduLHgjGGoMq+/UQSKhrIRzER4QwEfpXAR4xK6A 2+Rm5/Oy6wrnvoMjKgIW/sU3iZPB5BvLmud685IMLmZNkVXsQdoCd1M0usdyUqWCSMQiUoE+OqVwj bBoUNv0XdAvvS2CvW3z8yqf/EhNxjRIoNSA+zfg4Z4PEgmYpJsGWXIOHBLbGZMokEMgABkM8ucZ7N 4N43XFyoCjj5mcFTtMOxy2sRMv8R8Eo/jhgldM13HA5xyqzAROezypfe+MZzeEdKkOlOpwrik2Zct N8bi8DQmqj7bammBozFL1sX8OOioHVg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKk2O-0006Mp-J6; Thu, 08 Nov 2018 13:07:56 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKk2M-0006MX-6e for linux-um@bombadil.infradead.org; Thu, 08 Nov 2018 13:07:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=DckAQzTmOtHpRV68unkXlGZ0kkQRboBrN94KXsFFOsU=; b=BLPM4w1WF2APsyNKu3ZUwEK+3 Er4FfqvCJuTRib7eeqKOKJeEEGdwfwaW97OIn6yV3/2vXzGq9uWHdoHWr1RbyWx66g1O2mRvLVB4u jpk/R7YFmhNYDlEeXJKt+Mjy3JkgRVlfM2sTs0iwi4cxvEDOUv8ljc9AjQyzjCSSVbWGhy2AmGtV3 et9RhnxCT0UNxUo30o0VZp5lgzqEo9m5RhQzfqLnskHiCYPp7fO+Qp11nLKYIsfQW63eF3uyOgccz ao8pzfhGiaae8xFlmJg7S/WGmxiFUu460+ZmisnJx3vPkFCBwLyNEpbKWRWxT4ZMPcVhfLPjtHD0I VKaahTTiA==; Received: from ivanoab6.miniserver.com ([5.153.251.140] helo=www.kot-begemot.co.uk) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gKk2J-0000tE-4B for linux-um@lists.infradead.org; Thu, 08 Nov 2018 13:07:52 +0000 Received: from [192.168.17.6] (helo=smaug.kot-begemot.co.uk) by www.kot-begemot.co.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gKk27-0004lO-DU; Thu, 08 Nov 2018 13:07:39 +0000 Received: from amistad.kot-begemot.co.uk ([192.168.3.89]) by smaug.kot-begemot.co.uk with esmtp (Exim 4.89) (envelope-from ) id 1gKk21-0005mn-2J; Thu, 08 Nov 2018 13:07:34 +0000 From: anton.ivanov@cambridgegreys.com To: linux-um@lists.infradead.org Subject: [PATCH] Fix breakage from switching to MQ BLK framework Date: Thu, 8 Nov 2018 13:07:23 +0000 Message-Id: <20181108130723.12101-1-anton.ivanov@cambridgegreys.com> X-Mailer: git-send-email 2.11.0 X-Spam-Score: -1.0 X-Spam-Score: -1.0 X-Clacks-Overhead: GNU Terry Pratchett X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181108_130751_178480_B053F896 X-CRM114-Status: GOOD ( 10.80 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: axboe@kernel.dk, richard@nod.at, hch@lst.de, Anton Ivanov MIME-Version: 1.0 Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Anton Ivanov Initial version by Jens Axboe 1. Fix use of use unititalized req->error for SYNC commands 2. Guard the request submission by a spinlock Signed-off-by: Anton Ivanov --- arch/um/drivers/ubd_kern.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 74c002ddc0ce..e3d587d9eff6 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -1305,6 +1305,7 @@ static int ubd_queue_one_vec(struct blk_mq_hw_ctx *hctx, struct request *req, io_req->fds[0] = dev->cow.fd; else io_req->fds[0] = dev->fd; + io_req->error = 0; if (req_op(req) == REQ_OP_FLUSH) { io_req->op = UBD_FLUSH; @@ -1313,9 +1314,7 @@ static int ubd_queue_one_vec(struct blk_mq_hw_ctx *hctx, struct request *req, io_req->cow_offset = -1; io_req->offset = off; io_req->length = bvec->bv_len; - io_req->error = 0; io_req->sector_mask = 0; - io_req->op = rq_data_dir(req) == READ ? UBD_READ : UBD_WRITE; io_req->offsets[0] = 0; io_req->offsets[1] = dev->cow.data_offset; @@ -1341,11 +1340,15 @@ static int ubd_queue_one_vec(struct blk_mq_hw_ctx *hctx, struct request *req, static blk_status_t ubd_queue_rq(struct blk_mq_hw_ctx *hctx, const struct blk_mq_queue_data *bd) { + struct ubd *ubd_dev = hctx->queue->queuedata; struct request *req = bd->rq; + unsigned long flags; int ret = 0; blk_mq_start_request(req); + spin_lock_irqsave(&ubd_dev->lock, flags); + if (req_op(req) == REQ_OP_FLUSH) { ret = ubd_queue_one_vec(hctx, req, 0, NULL); } else { @@ -1361,6 +1364,8 @@ static blk_status_t ubd_queue_rq(struct blk_mq_hw_ctx *hctx, } } out: + spin_unlock_irqrestore(&ubd_dev->lock, flags); + if (ret < 0) { blk_mq_requeue_request(req, true); }