Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1247090lfc; Wed, 1 Jun 2022 13:00:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygsYqXV98YI7aOkxBZ36JFPsosp5GPajcKJXsLmBN4Mlt5tBSTc1IxNjH54yhlH/fDKhYI X-Received: by 2002:a05:6a00:15c5:b0:518:a654:1bf8 with SMTP id o5-20020a056a0015c500b00518a6541bf8mr48424088pfu.23.1654113623191; Wed, 01 Jun 2022 13:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654113623; cv=none; d=google.com; s=arc-20160816; b=ccxrSJZ74N27O7jV+ZXiGCmoDnrU7E4V41HVZBvNFIofwPxLJ8+U8va2Z+gZt9fqd4 IoDdIlfrPIJqiTMR2IUoLWdHEIS8moaanCCvm3ROYvd3xVdkKIhEZF48yPyFC6GguA6Z eJMZ842Qm+SY1m2EXypbHZ2QqwiTu65Df7sGUgclEfOe4CbGJKHM71fJqzsNjvNpIk/5 Ht2h/o8ToSGLcSowlGeCkOi4m6Zxg5+kRLSaLznJzaJZnLUNfE8Xpxrp5K1/5F763UHL pgqNtYvvGlEQZWXEexinNl+YCXXEbsORFmkxLdd29UnJODraVeSwmhu16X94J2LjADvj rn2Q== 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=a87IcC9urf+k/BpqnG3OjFGgMumKd7iQpHu0ssOaiic=; b=WQvzkveFQ3mOGBdeZblnUx3plvGiTBuDEZOa28MoOvf7rl1sRYyc/quple5XLOTjfx +AmWE9jrCWysOR4OLZUC3NiKSAtMavbRYHlci9o6F7XwZ6E7V4ajY9oCJNUDNbzCBNPr k5MIL/4QOoXZQwpNkyn7Dfy+rfGgIplcH+ykLuEenpE1Ql/XxrRLk5wzd072xv241H3F k1afA/tf7gg4fVyFf8qr0jxWnJG1l6xx+jRAhfxBdxGtZ+ft/A7UP5lUbwx2FH5pR2sv FwRxlBWVCJT4KcMRcmlEzrW/prLunyqvTaXSr7Naj/Pp6LEV+S0KFIMViFK1qY4bGSPe ZbYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KQ6xfJ2M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e18-20020a056a001a9200b004fb142acb57si3368818pfv.160.2022.06.01.13.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 13:00:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KQ6xfJ2M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 012381567D4; Wed, 1 Jun 2022 12:18:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348924AbiFABMM (ORCPT + 99 others); Tue, 31 May 2022 21:12:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348910AbiFABMJ (ORCPT ); Tue, 31 May 2022 21:12:09 -0400 Received: from mail-yw1-x112f.google.com (mail-yw1-x112f.google.com [IPv6:2607:f8b0:4864:20::112f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F39B91A3A1 for ; Tue, 31 May 2022 18:12:06 -0700 (PDT) Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-2ec42eae76bso2709127b3.10 for ; Tue, 31 May 2022 18:12:06 -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=a87IcC9urf+k/BpqnG3OjFGgMumKd7iQpHu0ssOaiic=; b=KQ6xfJ2MAx8t5MCYwFKqlYdylzl0qF96ue+1TQyTzPIVqA1MdgUob06UcOoIjKW79i wsE4ILBjjsv/D1JUbtoib1/KfZ7P54OcZCrSadx67qPJ+3OGSTxgFodRzydg3MfH2xZ+ D08AjOQmDAsg9claFvSgYRGipck7i4+lJsGc0= 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=a87IcC9urf+k/BpqnG3OjFGgMumKd7iQpHu0ssOaiic=; b=0GlWZ3ZQAeG5bkQqCLw/E122fzjcwpCBEFms8dmdhproG+w9zy0+rsYQfbLO5eICdx ozumlBU3pdd14Xtva3UrshMUqvZrjv5ooH+ay5UF94ZFh2VkNtAqqFOPy4YgR2nLrH92 ZEUhXMLAd1cP+MCN6I5RZWwk3I/StMXlDDX5w7N/UdWm/EE8YLBiSO2U5SkpfzM1gFqw bNpHJOixDKwDYFQcsk/Kq9WMLiqzz+oVnr6TM5JsPQ23PsyD5VHr6MdR1VAEK91GYR3B sRGxAihBgn5407PHhsX1hgn6jAqER7xwRYP7+bxTzKQGvQrTb5orqh7hF/gYIduz68xk hcgQ== X-Gm-Message-State: AOAM531RrlACH/VRTQ2hG8r3Tsg+pAYQuEaOUwZB0DCFu1ZH2ObTo4aV ekDJfgvtGFtxwEUNolN7Pbh3+DSQN74P+bIaMjrJHw== X-Received: by 2002:a81:848c:0:b0:30c:4684:3b6 with SMTP id u134-20020a81848c000000b0030c468403b6mr15060632ywf.77.1654045926104; Tue, 31 May 2022 18:12:06 -0700 (PDT) MIME-Version: 1.0 References: <20220530013958.577941-1-dlunev@chromium.org> <20220530113953.v3.1.I0e579520b03aa244906b8fe2ef1ec63f2ab7eecf@changeid> In-Reply-To: From: Daniil Lunev Date: Wed, 1 Jun 2022 11:11:55 +1000 Message-ID: Subject: Re: [PATCH v3 1/2] fs/super: function to prevent super re-use To: Christoph Hellwig Cc: linux-fsdevel@vger.kernel.org, miklos@szeredi.hu, viro@zeniv.linux.org.uk, tytso@mit.edu, fuse-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Thank you for your comments. Uploaded v4 with requested changes. --Daniil On Tue, May 31, 2022 at 5:24 PM Christoph Hellwig wrote: > > On Mon, May 30, 2022 at 11:39:57AM +1000, Daniil Lunev wrote: > > +void retire_super(struct super_block *sb) > > +{ > > + down_write(&sb->s_umount); > > + if (sb->s_bdi != &noop_backing_dev_info) { > > + if (sb->s_iflags & SB_I_PERSB_BDI && !(sb->s_iflags & SB_I_RETIRED)) > > SB_I_PERSB_BDI can't be set for noop_backing_dev_info, so that check > should not be needed. Which also conveniently fixes the overly long > line. > > Also this should clear SB_I_PERSB_BDI as the only place that checks > it is the unregistration. > > > spin_lock(&sb_lock); > > - /* should be initialized for __put_super_and_need_restart() */ > > This is a completely unrelated change. While the function is gone > it might be worth to check what it got renamed to or folded in, or > if the initialization is still needed. But all that is for a separate > patch. > > > up_write(&sb->s_umount); > > if (sb->s_bdi != &noop_backing_dev_info) { > > - if (sb->s_iflags & SB_I_PERSB_BDI) > > + /* retire should have already unregistered bdi */ > > + if (sb->s_iflags & SB_I_PERSB_BDI && !(sb->s_iflags & SB_I_RETIRED)) > > bdi_unregister(sb->s_bdi); > > bdi_put(sb->s_bdi); > > And once SB_I_PERSB_BDI is dropped when retiring we don't need this > change.