From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C102FC433B4 for ; Tue, 20 Apr 2021 20:12:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76A06613C8 for ; Tue, 20 Apr 2021 20:12:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233874AbhDTUMw (ORCPT ); Tue, 20 Apr 2021 16:12:52 -0400 Received: from gardel.0pointer.net ([85.214.157.71]:34164 "EHLO gardel.0pointer.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233869AbhDTUMw (ORCPT ); Tue, 20 Apr 2021 16:12:52 -0400 Received: from gardel-login.0pointer.net (gardel-mail [IPv6:2a01:238:43ed:c300:10c3:bcf3:3266:da74]) by gardel.0pointer.net (Postfix) with ESMTP id 9EB00E8098F; Tue, 20 Apr 2021 22:12:15 +0200 (CEST) Received: by gardel-login.0pointer.net (Postfix, from userid 1000) id 2A6EE1604AE; Tue, 20 Apr 2021 22:12:15 +0200 (CEST) Date: Tue, 20 Apr 2021 22:12:15 +0200 From: Lennart Poettering To: Christoph Hellwig Cc: Matthew Wilcox , Matteo Croce , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Boccassi , Jens Axboe , Alexander Viro , Damien Le Moal , Tejun Heo , Javier Gonz?lez , Niklas Cassel , Johannes Thumshirn , Hannes Reinecke Subject: Re: [PATCH -next 1/5] block: add disk sequence number Message-ID: References: <20210315200242.67355-1-mcroce@linux.microsoft.com> <20210315200242.67355-2-mcroce@linux.microsoft.com> <20210315201824.GB2577561@casper.infradead.org> <20210316141326.GA37773@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210316141326.GA37773@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Di, 16.03.21 14:13, Christoph Hellwig (hch@infradead.org) wrote: > On Mon, Mar 15, 2021 at 08:18:24PM +0000, Matthew Wilcox wrote: > > On Mon, Mar 15, 2021 at 09:02:38PM +0100, Matteo Croce wrote: > > > From: Matteo Croce > > > > > > Add a sequence number to the disk devices. This number is put in the > > > uevent so userspace can correlate events when a driver reuses a device, > > > like the loop one. > > > > Should this be documented as monotonically increasing? I think this > > is actually a media identifier. Consider (if you will) a floppy disc. > > Back when such things were common, it was possible with personal computers > > of the era to have multiple floppy discs "in play" and be prompted to > > insert them as needed. So shouldn't it be possible to support something > > similar here -- you're really removing the media from the loop device. > > With a monotonically increasing number, you're always destroying the > > media when you remove it, but in principle, it should be possible to > > reinsert the same media and have the same media identifier number. > > And we have some decent infrastructure related to media changes, > grep for disk_events. I think this needs to plug into that > infrastructure instead of duplicating it. I'd argue this makes sense in one way only, i.e. that whenever the media_change event is seen the seqnum is implicitly bumped. I am pretty sure though that loopback devices shouldn't synthesize media_change events themselves though. There's quite a difference I would argue between a real media change event caused by external effect (i.e. humans/hw buttons/sensors) to loop device reuse, which is exclusively triggered by internal events (i.e. local code). Moreover I think the loopback subsystem should manage the seqnum on its own, since it ideally would return the assigned seqnum immediately from the attachment ioctl, i.e. it shouldn't just be a side-effect of attachment, but a part of it, if you follow what I mean. Does that make sense? Matteo, would it make sense to extend your patch set to bump the seqnum implicitly on media_change for devices that implement that? Lennart