diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2023-12-08 19:39:27 +0300 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2023-12-11 13:19:17 +0300 |
commit | d28076ddda34d13aee675fbed52e3275af00f64d (patch) | |
tree | 2d840c98010d1e0f658b5b8402379e15faa04507 /fs/efivarfs | |
parent | 0e8d2444168dd519fea501599d150e62718ed2fe (diff) | |
download | linux-d28076ddda34d13aee675fbed52e3275af00f64d.tar.xz |
efivarfs: Move efivar availability check into FS context init
Instead of checking whether or not EFI variables are available when
creating the superblock, check it one step earlier, when initializing
the FS context for the mount. This way, no FS context will be created at
all, and we can drop the second check at .kill_sb() time entirely.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'fs/efivarfs')
-rw-r--r-- | fs/efivarfs/super.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index 869537f1a550..d4530e4eac06 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c @@ -296,9 +296,6 @@ static int efivarfs_fill_super(struct super_block *sb, struct fs_context *fc) struct dentry *root; int err; - if (!efivar_is_available()) - return -EOPNOTSUPP; - sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_blocksize = PAGE_SIZE; sb->s_blocksize_bits = PAGE_SHIFT; @@ -354,6 +351,9 @@ static int efivarfs_init_fs_context(struct fs_context *fc) { struct efivarfs_fs_info *sfi; + if (!efivar_is_available()) + return -EOPNOTSUPP; + sfi = kzalloc(sizeof(*sfi), GFP_KERNEL); if (!sfi) return -ENOMEM; @@ -370,9 +370,6 @@ static void efivarfs_kill_sb(struct super_block *sb) { kill_litter_super(sb); - if (!efivar_is_available()) - return; - /* Remove all entries and destroy */ efivar_entry_iter(efivarfs_destroy, &efivarfs_list, NULL); } |