Re: [PATCH v3 6/6] loop: increment sequence number
From: Christoph Hellwig
Date: Thu Jun 24 2021 - 02:12:43 EST
On Wed, Jun 23, 2021 at 05:29:17PM +0200, Lennart Poettering wrote:
> I am not sure I grok your point.
You don't.
> 1. First of all, loopback devices currently don't hook into the media
> change logic (which so far is focussed on time-based polling
> actually, for both CDs and floppies).
And that is the whole problem. We need to first fix loop devices to
hook into the existing mechanism to report media changes. We can then
enhance that mechanism to be more suitable to loop (avoid the polling)
and userspace (add a sequence number). But if we don't have the basic
agreement to fully integreat loop with the existing way that the kernel
reports media change we don't even need to discuss this series and can
just ignore it, as it simply won't be acceptable.
> Adding this would change
> semantics visibly to userspace (since userspace would suddenly see
> another action=change + DISK_MEDIA_CHANGE=1 uevent suddenly that it
> needs to handle correctly).
Yes, and that is a good thing as loop is currently completely broken
in this respect.
> 2. We want seqnums to be allocated for devices not only when doing
> media change (e.g. when attaching or detaching a loopback device)
> but also when allocating a block device, so that even before the
> first media change event a block device has a sequence number. This
> means allocating a sequence number for block devices won't be
> limited to the media change code anyway.
Doing this on creation is fine, and attaching is by definition a media
change.