Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp84910pxy; Tue, 20 Apr 2021 13:15:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyw0/zqUY5YsM4l8FdU4BRwDTkvdhZmI6eCMOJI8gXXB1bwgiFuao5MFX4agDlVjU9rCxSt X-Received: by 2002:a17:90a:17a3:: with SMTP id q32mr6969503pja.224.1618949701398; Tue, 20 Apr 2021 13:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618949701; cv=none; d=google.com; s=arc-20160816; b=juS7cCGp75itmSMiaVUiQpQ/YVtzNzxuMeV7AprrFJ3vfHyjZr0SqsxII3lgzb2n1q UK6TS3TgJD189O+RyZd24jp7cwPzIIlTPGO+mcII0Z/emASUGOzpt/OH3ZOMjJPyj38L sAxxZUg+kyhGcsq5I8OhHAQClQ30cDDVVTAeYPiittqBkPHvzTd4esJyYBsYwrlw28u9 S3myzTZtiF027e7l/JmUFHQ1rcUHyoQT4Pnkg5P+nlC798GzSyu15bb1oBicqBJZmpch HqLsMjahh9jfgpD926wptCcO+2mh7vVraft0QEq5N1cr8vNhXzAphv3MuUJ6jA8S+Mu/ SsNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=MuM4NlvxxSNaov944onWVzL9BWbYomr6RFM3Mbc8PVM=; b=qXf2NHHni6fkWSIO/WwBhXFo8rZGSbGeQlZ8vS05DYJwCaQ9uFOnyk/lfQ24NZ1VrT pEs5ll05/kiH2C3sozQqtOoQ5bpcGiqSPqFOgrURQMNk3Cs4nqxJ+g97iyvpaLonZ9af WcW8+ZF7wUeC5bEUeyoGvdrrLo23UV/rdkzobT1EL7KGn2V/0ZJiomELGCoxWS2+WZ22 einj22WNIoJhVGfQ2FpyEevrap5YaKWT0NG/sUYEvsuwgREx/n4PLjsGGdtQbwn/6fhs DS5PqI/UbToDYanU+nuvKhRWhzpTNBSb2VSOIpET3EcPSvJJ4bK8qPJjS3bq73QTkPsM j3yg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si75173pjg.17.2021.04.20.13.14.49; Tue, 20 Apr 2021 13:15:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233880AbhDTUMx (ORCPT + 99 others); Tue, 20 Apr 2021 16:12:53 -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-kernel@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