Subject: linux-next: manual merge of the efi tree with the efi-fixes tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 11 Dec 2023 15:13:03 +1100

Hi all,

Today's linux-next merge of the efi tree got a conflict in:

  fs/efivarfs/super.c

between commits:

  0b6d38bdd6f8 ("efivarfs: Free s_fs_info on unmount")
  ab5c4251a009 ("efivarfs: Move efivarfs list into superblock s_fs_info")

from the efi-fixes tree and commit:

  b501d5b36f58 ("efivarfs: automatically update super block flag")

from the efi tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/efivarfs/super.c
index d7d9a3e189a0,42eff5ac7ab4..000000000000
--- a/fs/efivarfs/super.c
+++ b/fs/efivarfs/super.c
@@@ -18,6 -20,32 +20,30 @@@
  
  #include "internal.h"
  
 -LIST_HEAD(efivarfs_list);
 -
+ struct efivarfs_info {
+ 	struct super_block *sb;
+ 	struct notifier_block nb;
+ };
+ 
+ static struct efivarfs_info info;
+ 
+ static int efivarfs_ops_notifier(struct notifier_block *nb, unsigned long event,
+ 				 void *data)
+ {
+ 	switch (event) {
+ 	case EFIVAR_OPS_RDONLY:
+ 		info.sb->s_flags |= SB_RDONLY;
+ 		break;
+ 	case EFIVAR_OPS_RDWR:
+ 		info.sb->s_flags &= ~SB_RDONLY;
+ 		break;
+ 	default:
+ 		return NOTIFY_DONE;
+ 	}
+ 
+ 	return NOTIFY_OK;
+ }
+ 
  static void efivarfs_evict_inode(struct inode *inode)
  {
  	clear_inode(inode);
@@@ -316,10 -345,17 +342,16 @@@ static int efivarfs_fill_super(struct s
  	if (!root)
  		return -ENOMEM;
  
+ 	info.sb = sb;
+ 	info.nb.notifier_call = efivarfs_ops_notifier;
+ 	err = blocking_notifier_chain_register(&efivar_ops_nh, &info.nb);
+ 	if (err)
+ 		return err;
+ 
 -	INIT_LIST_HEAD(&efivarfs_list);
 -
 -	err = efivar_init(efivarfs_callback, (void *)sb, true, &efivarfs_list);
 +	err = efivar_init(efivarfs_callback, (void *)sb, true,
 +			  &info->efivarfs_list);
  	if (err)
 -		efivar_entry_iter(efivarfs_destroy, &efivarfs_list, NULL);
 +		efivar_entry_iter(efivarfs_destroy, &info->efivarfs_list, NULL);
  
  	return err;
  }
@@@ -357,13 -399,15 +400,15 @@@ static int efivarfs_init_fs_context(str
  
  static void efivarfs_kill_sb(struct super_block *sb)
  {
 +	struct efivarfs_fs_info *sfi = sb->s_fs_info;
 +
+ 	blocking_notifier_chain_unregister(&efivar_ops_nh, &info.nb);
+ 	info.sb = NULL;
  	kill_litter_super(sb);
  
 -	if (!efivar_is_available())
 -		return;
 -
  	/* Remove all entries and destroy */
 -	efivar_entry_iter(efivarfs_destroy, &efivarfs_list, NULL);
 +	efivar_entry_iter(efivarfs_destroy, &sfi->efivarfs_list, NULL);
 +	kfree(sfi);
  }
  
  static struct file_system_type efivarfs_type = {