Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp141336imi; Thu, 21 Jul 2022 17:55:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tPS35yPICljY21LNuo+/t0mSisPve+0GmWNMqRnTEkRrskXgEf2w6MjTzETL9CykSdDP7c X-Received: by 2002:a05:6402:5186:b0:43a:b43a:40bc with SMTP id q6-20020a056402518600b0043ab43a40bcmr1022000edd.388.1658451321515; Thu, 21 Jul 2022 17:55:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658451321; cv=none; d=google.com; s=arc-20160816; b=XR3cHRD93FvUYaWDABy28o1TLpi2F+w4ZetC5ZaR7TbA/5i1z9ZAv6SSVEO2NF0nI5 t/gTlk4PAeMMpyvVinbvvs4hlRILa/cLpugeXNifuZO0mvnslvoMsDRvl8ntuV202CRt B0oivagsAc0EGPBH/CAYBFrgVi2XqCbgoBZ6U6YH41G/bf5cOS5hp+uib/Qi9O/8gMvR cXtJon7z12BIWis+6+bKCn4Uslm128arI1Y1CSgo81RFitSWk3e8kK8HcUPmYnVmQexP +3Va0JS86NopQqfTTKhg0lr3Q+v/Jnv7ViwSgJLz/GfMInxZalDPXQiEJzkDPoj8k8Me JbTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=LzafuiEWylnPx+vzKxgPtVmce8F0KReTVjWI/YPyHU4=; b=SoRVkj755MotYdE8tm7Fut0xwmf53A1/3lBfeSY5FMzsdgm+FzQdeD+QK1+2rdEzxP HAyt6LnT+vncTtB365ZU6udo3fk8qa/QzpDfIybqSvP9aA/4ud1xChz5Jx20JHpXBPjE 6+bB1FfWb116147/KrcuLCkUQd8Xs5S0D32lSVh9DzRY8klj5n1u1Splg3ExLSBUxg7p H3hI3wuEQNs5DqiZEKkODXRreb9W+3MVL+LVZjGRYZLcl0g/FVS4UFts2rvJPu1uIjae HU3hh9T4KWFMxlzDodD0jGpmx1VDmQAkZLzA2DfCpx6RnSnkMD5mk17ObjTRkdhl4iWy wWag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VDmFdkvm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h3-20020a50ed83000000b0043bc336c672si3089906edr.295.2022.07.21.17.54.56; Thu, 21 Jul 2022 17:55:21 -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=@chromium.org header.s=google header.b=VDmFdkvm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233079AbiGVAuj (ORCPT + 99 others); Thu, 21 Jul 2022 20:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbiGVAui (ORCPT ); Thu, 21 Jul 2022 20:50:38 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5A0592864 for ; Thu, 21 Jul 2022 17:50:35 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id k85so5623519ybk.7 for ; Thu, 21 Jul 2022 17:50:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LzafuiEWylnPx+vzKxgPtVmce8F0KReTVjWI/YPyHU4=; b=VDmFdkvmYxaqlvK5pwCslq7qP+NaqIS5QHCjkUOh7CHWeqj4fQi9OrzxXZksoefj47 S9mJ4sH1HdbNy5u427UWa41mdKjEAsAVsn8ZHCZVpwBQpro1XiWFFwyIsYtCV2kxujko 7G5p1TtijJKUQMaqY4/W28x8FlJgKKLBL3+DY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LzafuiEWylnPx+vzKxgPtVmce8F0KReTVjWI/YPyHU4=; b=sp0UhQYhsCGlUuFzR7pveEekzsdDer0za5N040+Ue+djXr7MExl2n2LrE9iX8Kqzzc 1TREX8CW350hP46LOvezdq8HSzPoFLVyoW4+F4DvaQDt1qKUs09S+zLsw5gHhs36euWF EosZd3XGAdIzYW560CiIIXmlHaYSWGqFOxFEuY/k3HwKHQJ0p138TZEd7ZY2eN/nZcOd fX2JAgXo7SopL8f28Vo9XTJz7+aD3svZIh3Kdl7VkeJP09EiVhPj4SZfZXNnhr1Ynr1a 5PZK7xr0NxV4foceQIYfFOcNeQdAJyyBrLP+qa/I1XSq0sgd6k/mUPDuB7l9JxdvxvQW iOsw== X-Gm-Message-State: AJIora+pHHX1J1uu2s3Dvk6cpCiEsmid5o2YuC8pWRvCtpcGU6LQGfhI Dslilp/Evs7bFfgpnOMUB1lrMgdhLlKI6Bqfd9RyGw== X-Received: by 2002:a05:6902:56c:b0:66f:9fbd:243e with SMTP id a12-20020a056902056c00b0066f9fbd243emr1072599ybt.518.1658451035215; Thu, 21 Jul 2022 17:50:35 -0700 (PDT) MIME-Version: 1.0 References: <20220601011103.12681-1-dlunev@google.com> <20220601111059.v4.1.I0e579520b03aa244906b8fe2ef1ec63f2ab7eecf@changeid> In-Reply-To: From: Daniil Lunev Date: Fri, 22 Jul 2022 10:50:24 +1000 Message-ID: Subject: Re: [PATCH v4 1/2] fs/super: function to prevent super re-use To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, Al Viro , Christoph Hellwig , "Theodore Ts'o" , linux-kernel@vger.kernel.org, fuse-devel , Daniil Lunev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 Hi Miklos, Thanks for your response and apologies for my delayed reply. Do I understand correctly that to cover non-block devices I would need to add the same check to test_keyed_super and to test_single_super? Am I missing any other place? --Daniil On Mon, Jul 18, 2022 at 7:51 PM Miklos Szeredi wrote: > > On Wed, 1 Jun 2022 at 03:11, Daniil Lunev wrote: > > > > From: Daniil Lunev > > > > The function is to be called from filesystem-specific code to mark a > > superblock to be ignored by superblock test and thus never re-used. The > > function also unregisters bdi if the bdi is per-superblock to avoid > > collision if a new superblock is created to represent the filesystem. > > generic_shutdown_super() skips unregistering bdi for a retired > > superlock as it assumes retire function has already done it. > > > > Signed-off-by: Daniil Lunev > > Signed-off-by: Daniil Lunev > > --- > > > > Changes in v4: > > - Simplify condition according to Christoph Hellwig's comments. > > > > Changes in v3: > > - Back to state tracking from v1 > > - Use s_iflag to mark superblocked ignored > > - Only unregister private bdi in retire, without freeing > > > > Changes in v2: > > - Remove super from list of superblocks instead of using a flag > > > > fs/super.c | 28 ++++++++++++++++++++++++++-- > > include/linux/fs.h | 2 ++ > > 2 files changed, 28 insertions(+), 2 deletions(-) > > > > diff --git a/fs/super.c b/fs/super.c > > index f1d4a193602d6..3fb9fc8d61160 100644 > > --- a/fs/super.c > > +++ b/fs/super.c > > @@ -422,6 +422,30 @@ bool trylock_super(struct super_block *sb) > > return false; > > } > > > > +/** > > + * retire_super - prevernts superblock from being reused > > s/prevernts/prevents/ > > > + * @sb: superblock to retire > > + * > > + * The function marks superblock to be ignored in superblock test, which > > + * prevents it from being reused for any new mounts. > > This works for block supers and nothing else, at least as this patch > stands. That might be okay, but should at least be documented. > > Thanks, > Miklos