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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 A6E90C48BC2 for ; Wed, 23 Jun 2021 14:27:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91F526101D for ; Wed, 23 Jun 2021 14:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231210AbhFWO3X (ORCPT ); Wed, 23 Jun 2021 10:29:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230061AbhFWO3W (ORCPT ); Wed, 23 Jun 2021 10:29:22 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F1F8C061574; Wed, 23 Jun 2021 07:27:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=DDDhkKoOSvn2SSqNME1lq0AiPIJcymhF4xvIun7LjzI=; b=tXCs140TX5Dp/CQfrgnASXfijn 78PTLXbWv37XLx1RsZQh3kUkN2I4QGm9SlH7fyJdRRJdFqALd1gUZ4eOd6o7+J03FvMM/2qILobp7 +mZgYskd6ChXuoDA5zGCjPiXTXMpI7yJMuaYkK25dNQ5sF3swAXX1ZTijJDfcrt9mllz7XgOq4Rlg WPZZyEaVkreWGJ4vBi7dpRJRrpkumYhDaFZijUS8Dyj+wUiZ8F4cJKqP21BxaWEGYzbFtbcJ/HsIJ wBO8Irhv87qkBTwWW6QTbulmxkMO5Dq7DpguJCdCERlRS2z4fcS17JitCT2Ksy5I1sz3+ZPTa9rYP 2+LiLb+w==; Received: from hch by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1lw3pF-00FW9x-Rd; Wed, 23 Jun 2021 14:26:08 +0000 Date: Wed, 23 Jun 2021 15:25:57 +0100 From: Christoph Hellwig To: Luca Boccassi Cc: Christoph Hellwig , Matteo Croce , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jens Axboe , linux-kernel@vger.kernel.org, Lennart Poettering , Alexander Viro , Damien Le Moal , Tejun Heo , Javier Gonz??lez , Niklas Cassel , Johannes Thumshirn , Hannes Reinecke , Matthew Wilcox , JeffleXu Subject: Re: [PATCH v3 6/6] loop: increment sequence number Message-ID: References: <20210623105858.6978-1-mcroce@linux.microsoft.com> <20210623105858.6978-7-mcroce@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 23, 2021 at 02:13:25PM +0100, Luca Boccassi wrote: > On Wed, 2021-06-23 at 12:57 +0100, Christoph Hellwig wrote: > > On Wed, Jun 23, 2021 at 12:58:58PM +0200, Matteo Croce wrote: > > > From: Matteo Croce > > > > > > On a very loaded system, if there are many events queued up from multiple > > > attach/detach cycles, it's impossible to match them up with the > > > LOOP_CONFIGURE or LOOP_SET_FD call, since we don't know where the position > > > of our own association in the queue is[1]. > > > Not even an empty uevent queue is a reliable indication that we already > > > received the uevent we were waiting for, since with multi-partition block > > > devices each partition's event is queued asynchronously and might be > > > delivered later. > > > > > > Increment the disk sequence number when setting or changing the backing > > > file, so the userspace knows which backing file generated the event: > > > > Instead of manually incrementing the sequence here, can we make loop > > generate the DISK_EVENT_MEDIA_CHANGE event on a backing device (aka > > media) change? > > Hi, > > This was answered in the v1 thread: > > https://lore.kernel.org/linux-fsdevel/20210315201331.GA2577561@casper.infradead.org/t/#m8a677028572e826352cbb1e19d1b9c1f3b6bff4b > > The fundamental issue is that we'd be back at trying to correlate > events to loopdev instances, which does not work reliably - hence this > patch series. With the new ioctl, we can get the id immediately and > without delay when we create the device, with no possible races. Then > we can handle events reliably, as we can correlate correctly in all > cases. I very much disagree with your reply there. The device now points to a different media. Both for the loop device, a floppy or a CD changer probably by some kind of user action. In the last cast it might even by done entirely locally through a script just like the loop device.