Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1017320rwd; Wed, 7 Jun 2023 09:48:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5q4Dt3yXaTjvwkZRRidP7Kg7/QPGPqoRHmNm5g78UPLuDX6wnRcCDZXgUt3s/6g4DXrvKH X-Received: by 2002:a17:902:c101:b0:1a3:cd4c:8d08 with SMTP id 1-20020a170902c10100b001a3cd4c8d08mr6084168pli.38.1686156534692; Wed, 07 Jun 2023 09:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686156534; cv=none; d=google.com; s=arc-20160816; b=kr0c9h7Ni5Gnn768FlYxcgPI1YK2UTe6C388Ha3dPT7e4HZHasNq98YokxhBa/lsmr RJAMRUeQPn3Q0bacHAJl9LADI8AitHh0RH7HaC88Xi7c3BaO57R2nz874/AFWRZhUB0p uv7bWwtOyND8Qk3HTRQXWSwCcJo+WgzNgPOdIEzL47//q8tNkjLdefQg8yV5hLQkochY /Dw6QnieQv20ByumakhENzAMw6s6/b0RcYmQKzAKca6ATlcws8Xa7HBQJkpQAx9WCBIL 5fSSlPTg5dk4RxpgEzwiUBoKKd95oMUx3GEyq/2rNjx+unGBudNS/Sh7CxpaSgGiON6a ZNVQ== 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:feedback-id :dkim-signature:dkim-signature; bh=42y1EYFXvq4hYeXlSpmVr7gmNpbInmaS7tgG+Ss9F5U=; b=OHqk758qNCOxfDE6QFDUKmvdxRc9K3/aydPjx1s9HHY3ZhT6EXj8RA40P9wSvngvvj tzaXQXINUQVNciDCOojEqC76h9Z4Eq+wrFuMC/VVmjfZaC4GRe/GKuWY6bFRCR773t8F KKJnWNiZ5PsXOqdpQWfYxrxuLzGwkUmT1HHJeK97V2M/3/gV+u8n0Eq/zDjJR5Q0j+i+ +KPJen8ShuSd4vs6JRdJTGcBe1kefKJlT9mzAXI1Rzc9woxW84SelEIjL/5sNbDPLXPu Uz9wibMfLnbICWu/OR9Q/dkBaAh9DGlqL01odZWlCQlFEZYtnvF4zERLMWw2z4k17z7i xgbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@invisiblethingslab.com header.s=fm1 header.b="CHxsNu/T"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b="CsL/olni"; 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 h5-20020a170902f54500b001ab007aff67si1613151plf.32.2023.06.07.09.48.40; Wed, 07 Jun 2023 09:48:54 -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=@invisiblethingslab.com header.s=fm1 header.b="CHxsNu/T"; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b="CsL/olni"; 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 S229815AbjFGQmK (ORCPT + 99 others); Wed, 7 Jun 2023 12:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229641AbjFGQmJ (ORCPT ); Wed, 7 Jun 2023 12:42:09 -0400 Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FA911FC4; Wed, 7 Jun 2023 09:42:08 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 194615C007C; Wed, 7 Jun 2023 12:42:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 07 Jun 2023 12:42:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1686156128; x=1686242528; bh=42y1EYFXvq4hYeXlSpmVr7gmNpbInmaS7tg G+Ss9F5U=; b=CHxsNu/TLuBvPTG0yHh4WOq5QJN1It8U4K4Mt15g1FIi6vpL6Ad 4SNv/41uiq14W8leF4UWTsz72Su5CRbXiIRYEnHIDHBx9oDZqT6ymIagHkd2CQwm wNifs0xXvmsiFF3ncmrudJvXcMTwLJELPyOnernFr6t3hASMW0zPB0PfLDwC0BW0 uHq3ry34wEAUTA3EsUXoZvNluvYHvcmg1lIB0QJ7a3DfUUW9bYOQ3lM4uFz62ezH Prl2L8QV+COLB0QySNuIbWY+j9m6wIwBBTmIGRXwua/wfc+B9Lhpp6LKDxOCNs1A bvTFZlTojHJl6zVroypQ8HtiXc5lAVlS+rQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1686156128; x=1686242528; bh=42y1EYFXvq4hY eXlSpmVr7gmNpbInmaS7tgG+Ss9F5U=; b=CsL/olnib/EC7s2AniVOsID2RnvaO gHEE1/PviC87GXlrK2jQrtRUoDiIUCd3PtoZMt1pM2/PfxbOkOjWQjNVZkVe/Lvr KUlvOi1I9n0bCjNREsjfXNTcuAmGB3wZUYXeFyqAUFyLIH0XI/ZdN2tZRXyBDIDw Q0OybDNsW02ypxRMnzz6nL11B8Pm6rec3hbwVmEFrw+0ZpslcCIJJN3Q1grAWypJ LgceyJdxSEpqDgSvmOPuPPq4XxJZ5J0z5qm3GBh9GhG88SW3k3wKeKyHBl/WLKwK 9wEObMIJ7i8awdQgzUCQQmLUcfv6L9lHBdVfEyqqz1sK1byku2VFQmGKg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgedtgedguddtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttdejnecuhfhrohhmpeffvghm ihcuofgrrhhivgcuqfgsvghnohhurhcuoeguvghmihesihhnvhhishhisghlvghthhhinh hgshhlrggsrdgtohhmqeenucggtffrrghtthgvrhhnpedvjeetgeekhfetudfhgfetffeg fffguddvgffhffeifeeikeektdehgeetheffleenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpeguvghmihesihhnvhhishhisghlvghthhhinhhg shhlrggsrdgtohhm X-ME-Proxy: Feedback-ID: iac594737:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 7 Jun 2023 12:42:07 -0400 (EDT) Date: Wed, 7 Jun 2023 12:42:00 -0400 From: Demi Marie Obenour To: Christoph Hellwig 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: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Lhc+hn0jVRR2V+8y" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, 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 --Lhc+hn0jVRR2V+8y Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Wed, 7 Jun 2023 12:42:00 -0400 From: Demi Marie Obenour To: Christoph Hellwig 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 On Wed, Jun 07, 2023 at 11:23:00AM -0400, Demi Marie Obenour wrote: > > > --- 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); > >=20 > > 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? >=20 > How does disk_force_media_change() call inc_diskseq()? I don=E2=80=99t s= ee any > calls in the source code. I=E2=80=99m going to use systemtap to see if t= here is > an indirect call chain. Were you thinking of bdev_check_media_change()? That can call inc_diskseq() via this call chain: bdev_check_media_change() disk_clear_events() disk_check_events() inc_diskseq() disk_force_media_change() does not call inc_diskseq(), and I checked that calling losetup -D does not change the diskseq of a loop device. =46rom what you have writte, I=E2=80=99m pretty sure that=E2=80=99s a bug in disk_force_media_change(), though. I=E2=80=99ll send a v3 that adds this c= all. --=20 Sincerely, Demi Marie Obenour (she/her/hers) Invisible Things Lab --Lhc+hn0jVRR2V+8y Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEdodNnxM2uiJZBxxxsoi1X/+cIsEFAmSAs10ACgkQsoi1X/+c IsGbBBAAoZxDjSSs9J+siCWh0MMyGUEwddaQhnOqS6hH//JuLOHDb71mJVF51gZR ayDHrJnYDhxsSpb02lxWKKPfo0plXSnTwb8gt2ZX+HUIXR+QteXUpfXzKi45ZwT7 p70ZnygsFNmn24ePKu5RS491F3n/Kz51PPdacIE429QBLi5YRAAlTTan4pOJRvRt bgliY4CSe63mDrCJ4GMd7614e4mTPrsaJYbAAx5ri1xJBNy8pKjbyUMcSfR5VQnu ujJgAXImHu3mzEeJlHKusofkCA43rWdhLsrZvrjArGXEXOcK7Qk4zkVUGh/dG7Ta QxljW+MD+foQRsFmsrc+XMfIpPuWy/AigkYi7a+jINyzwfmNqfnWwuxW4Q3mQlhu eJ7inplmVJ7xsPJKbRL/DcqiHvE+KgGU5GHuZPCwu7e9G+pkcEJ1kTqzHZrRTAJW WXhLxBLajojgzKCrbTusEmLuodkVMZpqM1VPsSBeGjYwV+BvVlymK15DWtlxffC4 XdsQHu88yG8rdDe4TO7GgSWfNXDGuIQOtmHTsvrvLR/XVduEByxaXdsYj5k5JO/V A7h0LAnLqTZo2+0tYqaFHHUjUHWua8edZYrdVvXTsNgkMfDol8/SGSSsbstvEbGz 8WGMKF+Qp8uA8T9fUDq95d6QDXwdg1E5NLawy7Yg9CfYScpy1Mg= =AmeY -----END PGP SIGNATURE----- --Lhc+hn0jVRR2V+8y--