From patchwork Mon Jan 8 20:21:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Lyle X-Patchwork-Id: 10150551 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 6BEDA605BA for ; Mon, 8 Jan 2018 20:22:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 773311FFDA for ; Mon, 8 Jan 2018 20:22:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BC7127EE2; Mon, 8 Jan 2018 20:22: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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 D814E289C2 for ; Mon, 8 Jan 2018 20:21:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757244AbeAHUVy (ORCPT ); Mon, 8 Jan 2018 15:21:54 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:44297 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757236AbeAHUVw (ORCPT ); Mon, 8 Jan 2018 15:21:52 -0500 Received: by mail-pf0-f194.google.com with SMTP id m26so6767252pfj.11 for ; Mon, 08 Jan 2018 12:21:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lyle-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DfUopsQOHJpGDcJXO1hAgjAbuT9igsGa4XScGkHvHnU=; b=Ljuiqd6z2izN2LAPSnclfX1AfQ6hFv0ogAs7YPBd79HyY6rw8Zz3hGiULFmbk2yk/N eJQAyHzJ3u7y8tR2AzbVf3zWhO7hGYCmdXArySxwvREqYT8Er4Xl+FC83nMxeVR2e9GT iao815p1SlIhVUXJ/g89M2eTIXr7J850kHFhEUWCSAzjFl79d3Y2wc3hgwiyNqJ5aiRs np1gJGJ9xv5Kfuo86n/RNOy3uJG1hovtB2U5Ly5mPmiCw+UvShzcTrzuxSLLw/oGAQFw St21GsouIHc8obn70DcqyuDNF3DOw7/26mecxy2APHyW3LtNpSpiDcqoFv3ABizmVINt 4sww== 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; bh=DfUopsQOHJpGDcJXO1hAgjAbuT9igsGa4XScGkHvHnU=; b=pp4Qx34WPbxz8Ok7uPR5/q2xdPWzJkxXhqF7+xJGHYaJmLmUzcsdEH42bkazvuJvep evcXItpVHdzh0/OEmteLocdCwKKbXgb/83Ib61YqAXarcqFu7LFK++0+cvEEH8ZjIWVP m/7SVN4wdPFDGxowxkoxf5zyUls9naL32jYl7i0EoTJL0Os2jk64bnlaqW2KhBqCMWma 8nh8Hf6OyuegBDL9mn88xSYj3zaYZn6vIv6l8+r5qInC2GUblvaJ6+qVIzw14NblcPZQ OL8nv4hWrixFeojKJ0P9wU67LnmQzxSSJmzd/Am51aY3mDYZcbk0tFOs8gQEuzsLJYCY okLQ== X-Gm-Message-State: AKGB3mIXTxFaMrjlngONR6qSxlYtBasmw1ZrAy+x07DvmMRTOGbcAjiV EXlnpFFZPhWKfMaugafav4GU4A== X-Google-Smtp-Source: ACJfBotYcsz9+PAanxuB/GTTNv49AQ0nb+WVuaNfiO1GalolI6wq9ZPmhAJok7vfi19Qv3jV3YxORw== X-Received: by 10.99.39.70 with SMTP id n67mr10490472pgn.323.1515442911788; Mon, 08 Jan 2018 12:21:51 -0800 (PST) Received: from midnight.lan (2600-6c52-6200-383d-a0f8-4aea-fac9-9f39.dhcp6.chtrptr.net. [2600:6c52:6200:383d:a0f8:4aea:fac9:9f39]) by smtp.gmail.com with ESMTPSA id o70sm28540227pfk.79.2018.01.08.12.21.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jan 2018 12:21:51 -0800 (PST) From: Michael Lyle To: linux-bcache@vger.kernel.org, linux-block@vger.kernel.org Cc: axboe@fb.com, Zhai Zhaoxuan Subject: [416 PATCH 10/13] bcache: fix unmatched generic_end_io_acct() & generic_start_io_acct() Date: Mon, 8 Jan 2018 12:21:27 -0800 Message-Id: <20180108202130.31303-11-mlyle@lyle.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180108202130.31303-1-mlyle@lyle.org> References: <20180108202130.31303-1-mlyle@lyle.org> 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 From: Zhai Zhaoxuan The function cached_dev_make_request() and flash_dev_make_request() call generic_start_io_acct() with (struct bcache_device)->disk when they start a closure. Then the function bio_complete() calls generic_end_io_acct() with (struct search)->orig_bio->bi_disk when the closure has done. Since the `bi_disk` is not the bcache device, the generic_end_io_acct() is called with a wrong device queue. It causes the "inflight" (in struct hd_struct) counter keep increasing without decreasing. This patch fix the problem by calling generic_end_io_acct() with (struct bcache_device)->disk. Signed-off-by: Zhai Zhaoxuan Reviewed-by: Michael Lyle Reviewed-by: Coly Li Reviewed-by: Tang Junhui --- drivers/md/bcache/request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index ddd941056f3c..1a46b41dac70 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -633,8 +633,8 @@ static void request_endio(struct bio *bio) static void bio_complete(struct search *s) { if (s->orig_bio) { - struct request_queue *q = s->orig_bio->bi_disk->queue; - generic_end_io_acct(q, bio_data_dir(s->orig_bio), + generic_end_io_acct(s->d->disk->queue, + bio_data_dir(s->orig_bio), &s->d->disk->part0, s->start_time); trace_bcache_request_end(s->d, s->orig_bio);