Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp372109rwd; Wed, 7 Jun 2023 00:46:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ47GiNWbeD6chSiIugyqlCu7AfyYrBYHpk6EbXTXEN81yeC37jD1j1y0lrYvWjWnu1HSgdH X-Received: by 2002:a5e:c806:0:b0:76f:f79e:78aa with SMTP id y6-20020a5ec806000000b0076ff79e78aamr4704292iol.17.1686124017338; Wed, 07 Jun 2023 00:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686124017; cv=none; d=google.com; s=arc-20160816; b=lb5Ya2618jeEa4dnTC0qdryeyJGLSNfRgOcBVIChejUSUK/cTyaayzvry4/6Uapiei Z55apSdrnuu0VNZH+sMpwtf56c4SOMjIhYT+UMrUCrOb3c0/KqhK44fZkZ6Cm8ng6R/w 2xBMrG/ZIdHmy14TIBeAkg36rCnXzA3ybAi/+3a+2t9M/Blswui5ZqDiyxwcZ8hSqBWl 3cbmfQIQclIEo/YKcE25JG+FYeF6d9NAmlpHPUMZFMPX4F1hUecTTMGh2q1RCWYnM19n 7tRe2BPlxdDnbsIEPP5ChHwXtX/yzQnDlK8urEQ6nsYzPwHFOnwbKoscBkizcvw/e4hC XbVg== 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:dkim-signature; bh=OM0BuqqlawJryT9IX33+CW481h0jO+pL7fC3zg1G8M0=; b=YPQQ6Y6J0CZK1vv4NaxOGO2QuRt+8ncIouDLcvRNm5UIqaQkI0wd3FUdqXdCNnbjJR HKu6c6xr3C2GEfVN3fDsCIpLMs42aM1oRarJk1TxxKNpxMZ4pxsecF8XnLK1OEti9m8/ V3dTizY0dAF0gaElXbPjlBW0eGfzeLlVGtIP6BHENJ9pHqzfxezQTCvg/7Oo8DJ4+Bxz qho3TvNnTP7KD7N7E80YzfilqISEFsUmtVF99tL6gN781I8usFHrhq4geHrq+3xsVZZo 8AqTJNFvzRqEGFRtFnC40K4LtEF0Mac5Oo6ZjZjw8D/Zy/nLLRE6avzSLBUjJGAtXRAn 8TiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Dwam7ai2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e190-20020a6369c7000000b005440b9f013csi1104741pgc.899.2023.06.07.00.46.44; Wed, 07 Jun 2023 00:46:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=Dwam7ai2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235194AbjFGHp6 (ORCPT + 99 others); Wed, 7 Jun 2023 03:45:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234874AbjFGHoe (ORCPT ); Wed, 7 Jun 2023 03:44:34 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC1041FC8; Wed, 7 Jun 2023 00:42:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=OM0BuqqlawJryT9IX33+CW481h0jO+pL7fC3zg1G8M0=; b=Dwam7ai2Hae6B/IyWvM+6/4d4U p1tzeI8V42Mp6UhB++W7VYusnoAtCzwBtZk2ORH+/kHpvZjMdvQTWp22BaTT2CT4Asp2/vjwmnDAW 4+t2O8KUOLuF8mK1xspDlcoWayDBpfhVZF/kaT7mp/sxc4TqtaUdeMQstgztfMxeXljLCKbYtNGm0 rsaIkR+DqpE2+hmPGKGdoZEojIBhwr5eCe1UOtaQamCLWia8dZv4RQzyuC2WPbII3siuQMYxhT0K/ 6IA0O8xrKNXavDlT9BOuv6sjNWDK6dhQMHfzVCqusXh5VEPi/X2AWFEpueZz7Lly2Oj65xdzkh26O L6co5k5g==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1q6no3-004mhI-09; Wed, 07 Jun 2023 07:42:11 +0000 Date: Wed, 7 Jun 2023 00:42:11 -0700 From: Christoph Hellwig To: Demi Marie Obenour Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] block, loop: Increment diskseq when releasing a loop device Message-ID: References: <20230601222656.2062-1-demi@invisiblethingslab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230601222656.2062-1-demi@invisiblethingslab.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +++ b/block/genhd.c > @@ -1502,3 +1502,4 @@ void inc_diskseq(struct gendisk *disk) > { > disk->diskseq = atomic64_inc_return(&diskseq); > } > +EXPORT_SYMBOL(inc_diskseq); I really do not like exporting this as a lowlevel function. If we increment the sequence it should be part of a higher level operation. > --- a/drivers/block/loop.c > +++ b/drivers/block/loop.c > @@ -1205,6 +1205,12 @@ static void __loop_clr_fd(struct loop_device *lo, bool release) > if (!part_shift) > set_bit(GD_SUPPRESS_PART_SCAN, &lo->lo_disk->state); > mutex_lock(&lo->lo_mutex); > + > + /* > + * Increment the disk sequence number, so that userspace knows this > + * device now points to something else. > + */ > + inc_diskseq(lo->lo_disk); And I'm not sure why we even need this. __loop_clr_fd already calls disk_force_media_change, which calls inc_diskseq. Why do we need an extra increment?