lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5247002.OuBHJMaBYj@adelgunde>
Date:	Fri, 05 Feb 2016 10:03:41 +0100
From:	Markus Pargmann <mpa@...gutronix.de>
To:	Wouter Verhelst <w@...r.be>
Cc:	nbd-general <nbd-general@...ts.sourceforge.net>,
	lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] nbd: Issue a uevent when disconnecting

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. 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.

Thanks,

Markus

> 
> Signed-off-by: Wouter Verhelst <w@...r.be>
> ---
>  drivers/block/nbd.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index e4c5cc1..04d9563 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -417,6 +417,8 @@ static int nbd_thread_recv(struct nbd_device *nbd)
>  	spin_unlock_irqrestore(&nbd->tasks_lock, flags);
>  
>  	ret = device_create_file(disk_to_dev(nbd->disk), &pid_attr);
> +	kobject_uevent(&disk_to_dev(nbd->disk)->kobj, KOBJ_CHANGE);
> +
>  	if (ret) {
>  		dev_err(disk_to_dev(nbd->disk), "device_create_file failed!\n");
>  
> @@ -438,6 +440,7 @@ static int nbd_thread_recv(struct nbd_device *nbd)
>  	}
>  
>  	device_remove_file(disk_to_dev(nbd->disk), &pid_attr);
> +	kobject_uevent(&disk_to_dev(nbd->disk)->kobj, KOBJ_CHANGE);
>  
>  	spin_lock_irqsave(&nbd->tasks_lock, flags);
>  	nbd->task_recv = NULL;
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ