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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E0A3C433EF for ; Wed, 1 Jun 2022 01:12:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348930AbiFABMM (ORCPT ); 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-Google-Smtp-Source: ABdhPJxN8CFFftQdSRWB+oFw+/9K6wx0YHUNqX3WYh3HcxuMASW/AiqGynB9Key4qJsp58N1ju6u+fPv+2562H6cc8Q= 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" 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.