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 D005DC433F5 for ; Tue, 31 May 2022 07:24:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244477AbiEaHYn (ORCPT ); Tue, 31 May 2022 03:24:43 -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 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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.