From patchwork Tue Jun 5 00:42:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Torvalds X-Patchwork-Id: 10447517 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 6FDD660467 for ; Tue, 5 Jun 2018 00:42:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C655291BE for ; Tue, 5 Jun 2018 00:42:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F126291C9; Tue, 5 Jun 2018 00:42:20 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 1351A291BE for ; Tue, 5 Jun 2018 00:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751295AbeFEAmS (ORCPT ); Mon, 4 Jun 2018 20:42:18 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:41538 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751046AbeFEAmR (ORCPT ); Mon, 4 Jun 2018 20:42:17 -0400 Received: by mail-io0-f196.google.com with SMTP id t5-v6so1197599ioa.8 for ; Mon, 04 Jun 2018 17:42:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uQMlS2fV7m347TUG0Jjl8YdgzvPcNWqqshLRQJdHLvI=; b=gjWe5Z2EkS32QmOb4AmQ21U3Av16qi/bTowWQnqIAPRmN/AAXkYGtXyz8yjfUeovfU iXqBJXml9OYNLxIb4Z4nyK7rMoQcXC71Zsv0ooFt0/juhKY1KxQpQs2MNwvc4hcY932I ae7n9kH1bBuQl3ARKBiQATROF0b4G4H56ZN0A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uQMlS2fV7m347TUG0Jjl8YdgzvPcNWqqshLRQJdHLvI=; b=MvuR90yY6KbNC+pxtzgOlCSDHVwYbmAczXrOcSJ8WHfL6oACeCkz+OEwFn32L7PQQq nC7j6RBRQrUbp+/Rw60lRtRyMxoc/pj0RVtR4cKARaR44WiTz7I/JJ0A+JclT1gkovbU GRpWFYoqhDS8E61Tzj1fcDo7KxMOjR8MdNhtqKXTVAy45COk1w3Umy5XdRnS22kfJhXk 2dDUXV1jYII9VIr5WtGQz7AjXZfBcnm7PYi1qSXMUxznvrdGhSY+KdWU2DUh49nnLlDA tfepS6R/dEDxunpnFg8vE06dPliHKcjmfYZ/+BVAbbDzsF+qIOEdYe/4JMCgAh/gjezK 5hbQ== X-Gm-Message-State: ALKqPwd8FvZHuJ1w2zaOMj5+bV5ZoMvQnUjVbsoETkCTpFmkKFm1XosG mqKFKZzOk+dDMEKNwhqiiB06l12HeSsq9o2eYqE= X-Google-Smtp-Source: ADUXVKJT/yQcppy0N9q+4YhmgS/obplddz0lERZ4g623q5KvYMZJjOf9aoMNYGmvcqBehecnhIm7YGZWw5eHVjQEMZk= X-Received: by 2002:a6b:ce15:: with SMTP id p21-v6mr16249352iob.257.1528159336889; Mon, 04 Jun 2018 17:42:16 -0700 (PDT) MIME-Version: 1.0 References: <11b01169-8e11-34ed-8137-aa5cd50a39c2@kernel.dk> <52aaf207-ef5d-a886-66fe-566de9d9bbee@kernel.dk> <20180604182017.GA1351649@devbig577.frc2.facebook.com> <20180604190428.GA30325@kmo-pixel> In-Reply-To: <20180604190428.GA30325@kmo-pixel> From: Linus Torvalds Date: Mon, 4 Jun 2018 17:42:04 -0700 Message-ID: Subject: Re: [GIT PULL] Block changes for 4.18-rc To: Kent Overstreet Cc: Jens Axboe , Tejun Heo , linux-block , NeilBrown , Arnd Bergmann 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 On Mon, Jun 4, 2018 at 12:04 PM Kent Overstreet wrote: > > However, that's not correct as is because mddev_delayed_put() calls > kobject_put(), and the kobject isn't initialized when the mddev is first > allocated, it's initialized when the gendisk is allocated... that isn't hard to > fix but that's getting into real refactoring that I'll need to put actual work > into testing. Well, it also removes the bioset_exit() calls entirely. How about just the attached? It simply does it as two different cases, and adds the bioset_exit() calls to mddev_delayed_delete(). Hmm? Linus drivers/md/md.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index fc692b7128bb..6a2494065ab2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -510,11 +510,6 @@ static void mddev_delayed_delete(struct work_struct *ws); static void mddev_put(struct mddev *mddev) { - struct bio_set bs, sync_bs; - - memset(&bs, 0, sizeof(bs)); - memset(&sync_bs, 0, sizeof(sync_bs)); - if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock)) return; if (!mddev->raid_disks && list_empty(&mddev->disks) && @@ -522,10 +517,6 @@ static void mddev_put(struct mddev *mddev) /* Array is not configured at all, and not held active, * so destroy it */ list_del_init(&mddev->all_mddevs); - bs = mddev->bio_set; - sync_bs = mddev->sync_set; - memset(&mddev->bio_set, 0, sizeof(mddev->bio_set)); - memset(&mddev->sync_set, 0, sizeof(mddev->sync_set)); if (mddev->gendisk) { /* We did a probe so need to clean up. Call * queue_work inside the spinlock so that @@ -534,12 +525,15 @@ static void mddev_put(struct mddev *mddev) */ INIT_WORK(&mddev->del_work, mddev_delayed_delete); queue_work(md_misc_wq, &mddev->del_work); - } else - kfree(mddev); + spin_unlock(&all_mddevs_lock); + return; + } } spin_unlock(&all_mddevs_lock); - bioset_exit(&bs); - bioset_exit(&sync_bs); + + bioset_exit(&mddev->bio_set); + bioset_exit(&mddev->sync_set); + kfree(mddev); } static void md_safemode_timeout(struct timer_list *t); @@ -5234,6 +5228,9 @@ static void mddev_delayed_delete(struct work_struct *ws) { struct mddev *mddev = container_of(ws, struct mddev, del_work); + bioset_exit(&mddev->bio_set); + bioset_exit(&mddev->sync_set); + sysfs_remove_group(&mddev->kobj, &md_bitmap_group); kobject_del(&mddev->kobj); kobject_put(&mddev->kobj);