From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752574AbcBEJok (ORCPT ); Fri, 5 Feb 2016 04:44:40 -0500 Received: from barbershop.grep.be ([89.106.240.122]:36731 "EHLO barbershop.grep.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750847AbcBEJog (ORCPT ); Fri, 5 Feb 2016 04:44:36 -0500 Date: Fri, 5 Feb 2016 10:42:41 +0100 From: Wouter Verhelst To: Markus Pargmann Cc: nbd-general , lkml Subject: Re: [PATCH v2] nbd: Issue a uevent when disconnecting Message-ID: <20160205094241.GC6366@grep.be> References: <1453566230-5786-1-git-send-email-w@uter.be> <20160202152700.GA7562@grep.be> <5247002.OuBHJMaBYj@adelgunde> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5247002.OuBHJMaBYj@adelgunde> X-Speed: Gates' Law: Every 18 months, the speed of software halves. Organization: none User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Markus, On Fri, Feb 05, 2016 at 10:03:41AM +0100, Markus Pargmann wrote: > Hi Wouter, > > On Tuesday, February 02, 2016 04:27:00 PM Wouter Verhelst wrote: > > There already is a uevent by default when closing a device upon connect > > of the device. However, the same isn't true on disconnect. > > > > This makes it hard for userspace to keep track of whether a device is > > connected, since we are notified when the connection is created, but not > > when it is removed again. > > > > Explicitly issue a "change" uevent to remedy. > > > > [v2: incorporate feedback from udev maintainer and make sure that we > > issue a uevent upon connect as well as disconnect, rather than connect > > only] > > The systemd people had the same feedback. Well, the systemd people and the udev people are the same people these days :-) > Basically the device is not marked as ready until a uevent is received. My > idea was to use the size property consistently. If the device is connected > the size is correctly changed and a uevent is created. On disconnect the size > is set to 0 with another uevent. > > Does this work for you as well? I will send the patch as reply. Sure. What matters most is that the uevent is done; how it's done, less so. I should add that this was meant to go with systemd #2422. I wasn't aware of #358, or I would've talked to you more :-) -- It is easy to love a country that is famous for chocolate and beer -- Barack Obama, speaking in Brussels, Belgium, 2014-03-26