From patchwork Wed Sep 13 11:10:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 139108 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:a8d:b0:3f2:4152:657d with SMTP id gr13csp104211vqb; Wed, 13 Sep 2023 14:47:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGLXp6DAb8r6bT8NqNk/S5m+vAhAvOqkFv/8B7GgV6k1+NepqwgDqv9XiD5rhXwJBiegcRw X-Received: by 2002:a17:902:d505:b0:1c0:b17a:7576 with SMTP id b5-20020a170902d50500b001c0b17a7576mr4626211plg.42.1694641626039; Wed, 13 Sep 2023 14:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694641626; cv=none; d=google.com; s=arc-20160816; b=XbNIqBJfFEpvO2y2dm3UgQ18gENOGhoK4VkFUoBf8ok1FS7VHSVr/qqggw4LpyHydz ZFZeoDWX+6u5y1+Z8BDmEkDrFeQy+b8OtUqY5cKznU0N41M/8f8L+pbHVf7pGBM4eop2 zuQVFiMfE9ggqvxinUtuORU1Zu5FFIXzFjsYQso4d45vL+Qt3Zu4aEc0I0JEZn9OMdJ9 SO3VEC0F0BT93Pdh3Gl6gLBfzFZNNElRD+z9xFXk+HFKGENNuEs3x3uHbU86PNc/aK6v Kn4RtocSCJGOHDgDkl7NCWfG0v9A7X/LhqYUdFsl3ni5QZmf+Q1jn+ngwLxD2/v1VxQj EuFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=S1SFy87Tal1zjTMpG/B1YzaZjyHevEyx/Ud+hlEwuTk=; fh=BKhaubn3NgfOFdJuURkVVw5laQp2qzBZJf/ffKnJtu8=; b=l9a//ItDW5nQ26acfd37KQVA/W+oFEN1novDuI1yeIWeW4l7AV3WUS+zEVnLWsuGzC 6wSaqIBXdB+fsYIEfPl/62IIX4PeVGrTqQq5Mmti3p/caxPSTYWlcLfQ085McTFsvZxy T1FaYfhjRDe0ePGx5YGiNcL0WNP0GYJPmQ6eCR1j3eVu+tj8U/LTpUOQ6NUytrn2NVeV 8savw8FcVByelyQQhXdnBEJDBM6aJ8UAfU6MZ8pCe2xqrlgRo+rg/xuELxv3iPUtFTEC oDdQQ0w0I9NT5qvyFc7czLpBdlTcQ6jQVeY8eq2r8ScP0R7EjYthWUKTSgYQDlwgXMou Sc2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="ZAxP4t/d"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id l16-20020a170903121000b001c3845d008csi204607plh.424.2023.09.13.14.47.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 14:47:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b="ZAxP4t/d"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id AED578256BC0; Wed, 13 Sep 2023 04:12:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240093AbjIMLMa (ORCPT + 36 others); Wed, 13 Sep 2023 07:12:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240084AbjIMLMH (ORCPT ); Wed, 13 Sep 2023 07:12:07 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA78D1BCE; Wed, 13 Sep 2023 04:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=S1SFy87Tal1zjTMpG/B1YzaZjyHevEyx/Ud+hlEwuTk=; b=ZAxP4t/djhRJyUxTiB1g1/4wNn Jy/Xo+IIkj7ixqhSE1v83lesrSKtdCY7mtxiQpdDWaA47Ad++ERcNIAoDq2vVNzeVPvQbWXtvvLM6 t/UO4IUIIeR8why07hc075q8lHsrKJI7D7mNsK+en+fXUEiPi0sUSYFaYxchkQ79W/EEUGGmwNJ+x DABx1LwgpU4GjE/l8YtCJy55AK2oNY5aPc3B1GTiJgyFJfms8hvozRaT9sViD54yzQ1nCUczSlOb4 CHMuF0drthpu+kXBBjg9uc0tJgUiLZA97kWEUVl45SwGmIFrXSS/HTgtHdzV3aMao1S4jWOC29Yio 34Xi/lzw==; Received: from [190.210.221.22] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qgNmL-005iD3-11; Wed, 13 Sep 2023 11:11:29 +0000 From: Christoph Hellwig To: Christian Brauner , Al Viro Cc: Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Fenghua Yu , Reinette Chatre , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Dennis Dalessandro , Tejun Heo , Trond Myklebust , Anna Schumaker , Kees Cook , Damien Le Moal , Naohiro Aota , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-rdma@vger.kernel.org, linux-nfs@vger.kernel.org, linux-hardening@vger.kernel.org, cgroups@vger.kernel.org Subject: [PATCH 19/19] fs: remove ->kill_sb Date: Wed, 13 Sep 2023 08:10:13 -0300 Message-Id: <20230913111013.77623-20-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230913111013.77623-1-hch@lst.de> References: <20230913111013.77623-1-hch@lst.de> MIME-Version: 1.0 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-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 13 Sep 2023 04:12:57 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776960537313773106 X-GMAIL-MSGID: 1776960537313773106 Now that no instances are left, remove ->kill_sb and mark generic_shutdown_super static. Signed-off-by: Christoph Hellwig --- Documentation/filesystems/locking.rst | 5 ----- Documentation/filesystems/vfs.rst | 5 ----- fs/super.c | 25 +++++++++---------------- include/linux/fs.h | 2 -- 4 files changed, 9 insertions(+), 28 deletions(-) diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst index c33e2f03ed1f69..e4ca99c0828d00 100644 --- a/Documentation/filesystems/locking.rst +++ b/Documentation/filesystems/locking.rst @@ -221,7 +221,6 @@ prototypes:: struct dentry *(*mount) (struct file_system_type *, int, const char *, void *); void (*shutdown_sb) (struct super_block *); - void (*kill_sb) (struct super_block *); void (*free_sb) (struct super_block *); locking rules: @@ -231,16 +230,12 @@ ops may block ======= ========= mount yes shutdown_sb yes -kill_sb yes free_sb yes ======= ========= ->mount() returns ERR_PTR or the root dentry; its superblock should be locked on return. -->kill_sb() takes a write-locked superblock, does all shutdown work on it, -unlocks and drops the reference. - address_space_operations ======================== prototypes:: diff --git a/Documentation/filesystems/vfs.rst b/Documentation/filesystems/vfs.rst index 1a7c6926c31f34..29513ee1d34ede 100644 --- a/Documentation/filesystems/vfs.rst +++ b/Documentation/filesystems/vfs.rst @@ -120,7 +120,6 @@ members are defined: struct dentry *(*mount) (struct file_system_type *, int, const char *, void *); void (*shutdown_sb) (struct super_block *); - void (*kill_sb) (struct super_block *); void (*free_sb) (struct super_block *); struct module *owner; struct file_system_type * next; @@ -164,10 +163,6 @@ members are defined: Note: dentries and inodes are normally taken care of and do not need specific handling unless they are pinned by kernel users. -``kill_sb`` - the method to call when an instance of this filesystem should be - shut down - ``free_sb`` Free file system specific resources like sb->s_fs_info that are still needed while inodes are freed during umount. diff --git a/fs/super.c b/fs/super.c index 805ca1dd1e23f2..d9c564e70ffcd5 100644 --- a/fs/super.c +++ b/fs/super.c @@ -458,6 +458,8 @@ static void kill_super_notify(struct super_block *sb) super_wake(sb, SB_DEAD); } +static void generic_shutdown_super(struct super_block *sb); + /** * deactivate_locked_super - drop an active reference to superblock * @s: superblock to deactivate @@ -480,15 +482,11 @@ void deactivate_locked_super(struct super_block *s) unregister_shrinker(&s->s_shrink); - if (fs->kill_sb) { - fs->kill_sb(s); - } else { - if (fs->shutdown_sb) - fs->shutdown_sb(s); - generic_shutdown_super(s); - if (fs->free_sb) - fs->free_sb(s); - } + if (fs->shutdown_sb) + fs->shutdown_sb(s); + generic_shutdown_super(s); + if (fs->free_sb) + fs->free_sb(s); kill_super_notify(s); @@ -661,16 +659,13 @@ EXPORT_SYMBOL(retire_super); * @sb: superblock to kill * * generic_shutdown_super() does all fs-independent work on superblock - * shutdown. Typical ->kill_sb() should pick all fs-specific objects - * that need destruction out of superblock, call generic_shutdown_super() - * and release aforementioned objects. Note: dentries and inodes _are_ - * taken care of and do not need specific handling. + * shutdown. * * Upon calling this function, the filesystem may no longer alter or * rearrange the set of dentries belonging to this super_block, nor may it * change the attachments of dentries to inodes. */ -void generic_shutdown_super(struct super_block *sb) +static void generic_shutdown_super(struct super_block *sb) { const struct super_operations *sop = sb->s_op; @@ -743,8 +738,6 @@ void generic_shutdown_super(struct super_block *sb) } } -EXPORT_SYMBOL(generic_shutdown_super); - bool mount_capable(struct fs_context *fc) { if (!(fc->fs_type->fs_flags & FS_USERNS_MOUNT)) diff --git a/include/linux/fs.h b/include/linux/fs.h index 302be5dfc1a04a..f57d3a27b488f7 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2340,7 +2340,6 @@ struct file_system_type { const struct fs_parameter_spec *parameters; struct dentry *(*mount) (struct file_system_type *, int, const char *, void *); - void (*kill_sb) (struct super_block *); void (*shutdown_sb)(struct super_block *sb); void (*free_sb)(struct super_block *sb); struct module *owner; @@ -2382,7 +2381,6 @@ extern struct dentry *mount_nodev(struct file_system_type *fs_type, int (*fill_super)(struct super_block *, void *, int)); extern struct dentry *mount_subtree(struct vfsmount *mnt, const char *path); void retire_super(struct super_block *sb); -void generic_shutdown_super(struct super_block *sb); void block_free_sb(struct super_block *sb); void litter_shutdown_sb(struct super_block *sb); void deactivate_super(struct super_block *sb);