From patchwork Wed Feb 28 18:15:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10249211 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 DDA2660384 for ; Wed, 28 Feb 2018 18:15:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E123928DEC for ; Wed, 28 Feb 2018 18:15:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5E4528E01; Wed, 28 Feb 2018 18:15:40 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 CAF7A28DED for ; Wed, 28 Feb 2018 18:15:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932153AbeB1SPh (ORCPT ); Wed, 28 Feb 2018 13:15:37 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:20781 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753095AbeB1SPf (ORCPT ); Wed, 28 Feb 2018 13:15:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1519841735; x=1551377735; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=u7Ml3eQMUS4/CYPKRSOc1LX+EzrLa6Lk4Q4x+1CDqCU=; b=Lcem/ZFtWnXV44EzqsMo9t0dm84qnSDjz60+MJpY6cSKQnCOiW9UMa/g TfEr1qSqxAqdKh1+V9YmY4TdVdmatAelC1O1qjHxbCv+HPxN8IOOq5PDU oP+Ah9OAPEsRQ9yqzh1FrPFU1EKdHvEZA1YH+9KBuxe2c/GiKv2oWZNPG TC//qCh7bcB9HyRQHS9JDwmgKF53L6i8UAM16uPEX9DhpVqiXyqdP9sLq j0uHWFU7FXIslsZzN3nQ9FNchDAbJ8LY2+CIBP9cdWNVSgL0ItZ3RBbTr JrH1IrCEzRh1VivSLRqACOWE/HjpFIsKeaJ7h0dXzflKl7crJx/ADn1k+ g==; X-IronPort-AV: E=Sophos;i="5.47,406,1515427200"; d="scan'208";a="73123312" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 01 Mar 2018 02:15:34 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 28 Feb 2018 10:08:58 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip02.wdc.com with ESMTP; 28 Feb 2018 10:15:33 -0800 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Shaohua Li Subject: [PATCH v5 2/6] md: Delete gendisk before cleaning up the request queue Date: Wed, 28 Feb 2018 10:15:29 -0800 Message-Id: <20180228181533.29402-3-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180228181533.29402-1-bart.vanassche@wdc.com> References: <20180228181533.29402-1-bart.vanassche@wdc.com> 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 Remove the disk, partition and bdi sysfs attributes before cleaning up the request queue associated with the disk. Signed-off-by: Bart Van Assche Reviewed-by: Johannes Thumshirn Reviewed-by: Joseph Qi Cc: Shaohua Li --- drivers/md/md.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index bc67ab6844f0..eba7fa2f0abb 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5203,12 +5203,12 @@ static void md_free(struct kobject *ko) if (mddev->sysfs_state) sysfs_put(mddev->sysfs_state); + if (mddev->gendisk) + del_gendisk(mddev->gendisk); if (mddev->queue) blk_cleanup_queue(mddev->queue); - if (mddev->gendisk) { - del_gendisk(mddev->gendisk); + if (mddev->gendisk) put_disk(mddev->gendisk); - } percpu_ref_exit(&mddev->writes_pending); kfree(mddev);