From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753168AbcICHP6 (ORCPT ); Sat, 3 Sep 2016 03:15:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36600 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751360AbcICHP5 (ORCPT ); Sat, 3 Sep 2016 03:15:57 -0400 Date: Sat, 3 Sep 2016 15:08:33 +0800 From: Fam Zheng To: "Michael S. Tsirkin" Cc: Christoph Hellwig , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH] virtio-blk: Generate uevent after attribute available Message-ID: <20160903070833.GA23269@al.usersys.redhat.com> References: <20160628023915.6012-1-famz@redhat.com> <20160628114553.GA18354@infradead.org> <20160629012414.GA23296@ad.usersys.redhat.com> <20160903015630-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160903015630-mutt-send-email-mst@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 03 Sep 2016 07:15:45 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 09/03 01:56, Michael S. Tsirkin wrote: > On Wed, Jun 29, 2016 at 09:24:15AM +0800, Fam Zheng wrote: > > On Tue, 06/28 04:45, Christoph Hellwig wrote: > > > On Tue, Jun 28, 2016 at 10:39:15AM +0800, Fam Zheng wrote: > > > > Userspace listens to the KOBJ_ADD uevent generated in add_disk. At that > > > > point we haven't created the serial attribute file, therefore depending > > > > on how fast udev reacts, the /dev/disk/by-id/ entry doesn't always get > > > > created. > > > > > > > > This race condition can be easily reproduced by hot plugging a number of > > > > virtio-blk disks. > > > > > > > > Also in systemd, there used to be a related workaround in udev rules > > > > called 'WAIT_FOR="serial"', but it is removed in later versions. > > > > > > > > Now let's generate a KOBJ_CHANGE event after the attributes are ready. > > > > > > The same race is present in other drivers as well, e.g. nvme. Please > > > find a way to make this work properly without needing to hack every > > > driver to send events manually. > > > > OK, I'll take a look today! > > > > Fam > > Was this fixed in the generic code? A proposed fix is: https://lkml.org/lkml/2016/8/17/81 Fam