Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4881409ioo; Tue, 31 May 2022 13:57:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUvU611EpDunWoQNVvqAC9dxXCuVEEkXNHb3HJ5WlOCZlNBwX8BEYLsQ8RD3ZVIQlXcAbO X-Received: by 2002:a17:907:6da4:b0:6fe:fa71:a726 with SMTP id sb36-20020a1709076da400b006fefa71a726mr38422292ejc.518.1654030667432; Tue, 31 May 2022 13:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654030667; cv=none; d=google.com; s=arc-20160816; b=liFsYKYaATpvK84HP0TGiIzP9eiv9LIhhKoIMXMB4kibVaJ5wvy/JY6P0YqNoR+hsi kP53/FXASrqiqHu1Sj9zLafJWao/yccOftTku/erzySKqY/T5shV5H4g+UHohVI1nXG8 vg4tND5CCjBPKC7zAcuCaLE8pH1b7eEhClcQtZq5xQbxaaB+GBzpM/jwIO/I3/hf+0l0 u3inmF97j96+adb9jrUShP+CfM8LTYFVj7DHaJj8F1CP2SIIe7lLFCliFIMDrXJv7OS9 kmRJfHzB1vZxnR4iJ63F/B4v5EtAutgtvqLXs9a7b1AfxLv5BpquWqfrGhC99aUNIAkk Ei/w== 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=nNgd/AJP2N1cOO4nuKxP7gM1kDhTHQ+2uxx2/aBNcQ8=; b=sW+PdBsQkP1LQrt0TQF65oJbae5h3nn57TlJ7z311NTACRxlvbWUmYNp/cqzmOICNn OlhwcGCtdSKbiQ8zJxSZ/46mHqtm7MC0iCtMehHrIKa2rDeK856omtw3Gg+BW3UT0GZK KUKwPN6ykDr5/eWco8adNLOwVR6WNogQyTGrkmDvuUQqSyO69ZQCKHPRxLGMAiTbQ21T 5iP71LA1ezkKsIkq0oy01oBITTsW0yurH54wL+0iZh2XuJrhX7yjbDgiReAuJIzxH3Ba PU+iGZqXlxFUhYu8bO1/JDd8ufeHW025/+r50+ikYOH0l5AbDKI7IG+UZbx0AjVdsGIq g8zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=x3gtBWfR; 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 g9-20020a056402090900b0041d9354ecacsi926541edz.222.2022.05.31.13.57.22; Tue, 31 May 2022 13:57:47 -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=x3gtBWfR; 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 S244480AbiEaHYo (ORCPT + 99 others); Tue, 31 May 2022 03:24:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232586AbiEaHYm (ORCPT ); Tue, 31 May 2022 03:24:42 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 827C492D09; Tue, 31 May 2022 00:24:41 -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=nNgd/AJP2N1cOO4nuKxP7gM1kDhTHQ+2uxx2/aBNcQ8=; b=x3gtBWfRVs9mW7pjrV+bxU+FIb 5yKqW+YXwxpFyHCY4szbOlt4MRKlMmjCTEs4Q8jG3e2jUdUgSooHy2WZ4qwonLP96mO5m0xp0Y5Yp Vv6sJpTbyBl8bRe6uvkzy+hUb8HHpXacm8UZryhQ5BVRYTQCmHgvQkFK3Y4DF9/pIXYozTgmHi4cP qTr2ei3YtH8gvyONFdwq162ySFtHFoiapSqVLqdD/OzOVQ0SSXJEvjjOD9zM5k+tdst0taLaNmPYp L37KBHe/w/LKwVLCssQ/Xk7AP6orT4Uf9bGFrz6ryVUnuZZyPhW+Yhdw2sjsT9+TmNOHH0+E6dfEB mA7gD0eg==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvwF5-009h80-8C; Tue, 31 May 2022 07:24:39 +0000 Date: Tue, 31 May 2022 00:24:39 -0700 From: Christoph Hellwig To: Daniil Lunev Cc: linux-fsdevel@vger.kernel.org, miklos@szeredi.hu, viro@zeniv.linux.org.uk, hch@infradead.org, tytso@mit.edu, fuse-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/2] fs/super: function to prevent super re-use Message-ID: References: <20220530013958.577941-1-dlunev@chromium.org> <20220530113953.v3.1.I0e579520b03aa244906b8fe2ef1ec63f2ab7eecf@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220530113953.v3.1.I0e579520b03aa244906b8fe2ef1ec63f2ab7eecf@changeid> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 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.