Skip to content

Commit 301de9a

Browse files
jhovoldardbiesheuvel
authored andcommitted
efivarfs: always register filesystem
The efivar ops are typically registered at subsys init time so that they are available when efivarfs is registered at module init time. Other efivars implementations, such as Google SMI, exist and can currently be built as modules which means that efivar may not be available when efivarfs is initialised. Move the efivar availability check from module init to when the filesystem is mounted to allow late registration of efivars. Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent beeb107 commit 301de9a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

fs/efivarfs/super.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ static int efivarfs_fill_super(struct super_block *sb, struct fs_context *fc)
194194
struct dentry *root;
195195
int err;
196196

197+
if (!efivar_is_available())
198+
return -EOPNOTSUPP;
199+
197200
sb->s_maxbytes = MAX_LFS_FILESIZE;
198201
sb->s_blocksize = PAGE_SIZE;
199202
sb->s_blocksize_bits = PAGE_SHIFT;
@@ -243,6 +246,9 @@ static void efivarfs_kill_sb(struct super_block *sb)
243246
{
244247
kill_litter_super(sb);
245248

249+
if (!efivar_is_available())
250+
return;
251+
246252
/* Remove all entries and destroy */
247253
efivar_entry_iter(efivarfs_destroy, &efivarfs_list, NULL);
248254
}
@@ -256,9 +262,6 @@ static struct file_system_type efivarfs_type = {
256262

257263
static __init int efivarfs_init(void)
258264
{
259-
if (!efivar_is_available())
260-
return -ENODEV;
261-
262265
return register_filesystem(&efivarfs_type);
263266
}
264267

0 commit comments

Comments
 (0)