[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230913111013.77623-20-hch@lst.de>
Date: Wed, 13 Sep 2023 08:10:13 -0300
From: Christoph Hellwig <hch@....de>
To: Christian Brauner <brauner@...nel.org>,
Al Viro <viro@...iv.linux.org.uk>
Cc: Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Reinette Chatre <reinette.chatre@...el.com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
Dennis Dalessandro <dennis.dalessandro@...nelisnetworks.com>,
Tejun Heo <tj@...nel.org>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna@...nel.org>,
Kees Cook <keescook@...omium.org>,
Damien Le Moal <dlemoal@...nel.org>,
Naohiro Aota <naohiro.aota@....com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-s390@...r.kernel.org, linux-rdma@...r.kernel.org,
linux-nfs@...r.kernel.org, linux-hardening@...r.kernel.org,
cgroups@...r.kernel.org
Subject: [PATCH 19/19] fs: remove ->kill_sb
Now that no instances are left, remove ->kill_sb and mark
generic_shutdown_super static.
Signed-off-by: Christoph Hellwig <hch@....de>
---
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);
--
2.39.2
Powered by blists - more mailing lists