Messages in this thread Patch in this message | | | From | Daniil Lunev <> | Subject | [PATCH 1/2] fs/super: Add a flag to mark super block defunc | Date | Wed, 11 May 2022 11:30:56 +1000 |
| |
File system can mark a block "defunc" in order to prevent matching against it in a new mount.
Signed-off-by: Daniil Lunev <dlunev@chromium.org> ---
fs/super.c | 4 ++-- include/linux/fs.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/super.c b/fs/super.c index f1d4a193602d6..fc5b3efe0cd01 100644 --- a/fs/super.c +++ b/fs/super.c @@ -1216,7 +1216,7 @@ static int set_bdev_super_fc(struct super_block *s, struct fs_context *fc) static int test_bdev_super_fc(struct super_block *s, struct fs_context *fc) { - return s->s_bdev == fc->sget_key; + return !s->s_defunc && s->s_bdev == fc->sget_key; } /** @@ -1307,7 +1307,7 @@ EXPORT_SYMBOL(get_tree_bdev); static int test_bdev_super(struct super_block *s, void *data) { - return (void *)s->s_bdev == data; + return !s->s_defunc && (void *)s->s_bdev == data; } struct dentry *mount_bdev(struct file_system_type *fs_type, diff --git a/include/linux/fs.h b/include/linux/fs.h index bbde95387a23a..76feb3fe9bb9e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1448,6 +1448,7 @@ struct super_block { struct rw_semaphore s_umount; int s_count; atomic_t s_active; + bool s_defunc; #ifdef CONFIG_SECURITY void *s_security; #endif -- 2.31.0
| |