From patchwork Thu Jun 30 01:59:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 9206469 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 1AF7F6075F for ; Thu, 30 Jun 2016 02:03:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C160284AA for ; Thu, 30 Jun 2016 02:03:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00BCC285FB; Thu, 30 Jun 2016 02:03:39 +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,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 71B6E284AA for ; Thu, 30 Jun 2016 02:03:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752482AbcF3CBL (ORCPT ); Wed, 29 Jun 2016 22:01:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46584 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752432AbcF3CBH (ORCPT ); Wed, 29 Jun 2016 22:01:07 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4DFCD12B20; Thu, 30 Jun 2016 02:01:07 +0000 (UTC) Received: from ad.usersys.redhat.com (dhcp-15-133.nay.redhat.com [10.66.15.133]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5U201qU029340; Wed, 29 Jun 2016 22:01:01 -0400 From: Fam Zheng To: linux-kernel@vger.kernel.org Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Jens Axboe , "Ed L. Cashin" , Jiri Kosina , "Michael S. Tsirkin" , Minchan Kim , Nitin Gupta , Sergey Senozhatsky , Shaohua Li , Ulf Hansson , David Woodhouse , Brian Norris , Keith Busch , linuxppc-dev@lists.ozlabs.org, linux-block@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, linux-nvme@lists.infradead.org, Christoph Hellwig , famz@redhat.com Subject: [PATCH v2 09/12] md: Generate uevent after attribute available Date: Thu, 30 Jun 2016 09:59:50 +0800 Message-Id: <20160630015953.6888-10-famz@redhat.com> In-Reply-To: <20160630015953.6888-1-famz@redhat.com> References: <20160630015953.6888-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 30 Jun 2016 02:01:07 +0000 (UTC) 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 It is documented that KOBJ_ADD should be generated after the object's attributes and children are ready. We can achieve this with the new disk_gen_uevents interface. Signed-off-by: Fam Zheng --- drivers/md/md.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 1391c72..dcd09ea 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5055,7 +5055,7 @@ static int md_alloc(dev_t dev, char *name) * through to md_open, so make sure it doesn't get too far */ mutex_lock(&mddev->open_mutex); - add_disk(disk, true); + add_disk(disk, false); error = kobject_init_and_add(&mddev->kobj, &md_ktype, &disk_to_dev(disk)->kobj, "%s", "md"); @@ -5070,6 +5070,7 @@ static int md_alloc(dev_t dev, char *name) if (mddev->kobj.sd && sysfs_create_group(&mddev->kobj, &md_bitmap_group)) printk(KERN_DEBUG "pointless warning\n"); + disk_gen_uevents(disk); mutex_unlock(&mddev->open_mutex); abort: mutex_unlock(&disks_mutex);