Subject: linux-next: manual merge of the vfs-brauner tree with the ext4 tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 21 Aug 2023 10:07:44 +1000

Hi all,

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

  fs/ext4/super.c

between commit:

  e89c6fc9b191 ("ext4: cleanup ext4_get_dev_journal() and ext4_get_journal()")

from the ext4 tree and commits:

  1489dffd51d7 ("ext4: close the external journal device in ->kill_sb")
  6f5fc7de9885 ("ext4: drop s_umount over opening the log device")

from the vfs-brauner tree.

I fixed it up (I think - 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/ext4/super.c
index 1873de52c26e,73547d2334fd..000000000000
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@@ -1096,34 -1097,26 +1097,6 @@@ void ext4_update_dynamic_rev(struct sup
  	 */
  }
  
- static void ext4_bdev_mark_dead(struct block_device *bdev)
- {
- 	ext4_force_shutdown(bdev->bd_holder, EXT4_GOING_FLAGS_NOLOGFLUSH);
- }
- 
- static const struct blk_holder_ops ext4_holder_ops = {
- 	.mark_dead		= ext4_bdev_mark_dead,
- };
- 
--/*
-  * Release the journal device
 - * Open the external journal device
-- */
- static void ext4_blkdev_remove(struct ext4_sb_info *sbi)
 -static struct block_device *ext4_blkdev_get(dev_t dev, struct super_block *sb)
--{
--	struct block_device *bdev;
- 	bdev = sbi->s_journal_bdev;
- 	if (bdev) {
- 		/*
- 		 * Invalidate the journal device's buffers.  We don't want them
- 		 * floating about in memory - the physical journal device may
- 		 * hotswapped, and it breaks the `ro-after' testing code.
- 		 */
- 		invalidate_bdev(bdev);
- 		blkdev_put(bdev, sbi->s_sb);
- 		sbi->s_journal_bdev = NULL;
- 	}
 -
 -	bdev = blkdev_get_by_dev(dev, BLK_OPEN_READ | BLK_OPEN_WRITE, sb,
 -				 &fs_holder_ops);
 -	if (IS_ERR(bdev))
 -		goto fail;
 -	return bdev;
 -
 -fail:
 -	ext4_msg(sb, KERN_ERR,
 -		 "failed to open journal device unknown-block(%u,%u) %ld",
 -		 MAJOR(dev), MINOR(dev), PTR_ERR(bdev));
 -	return NULL;
--}
--
  static inline struct inode *orphan_list_entry(struct list_head *l)
  {
  	return &list_entry(l, struct ext4_inode_info, i_orphan)->vfs_inode;
@@@ -5813,16 -5828,17 +5792,19 @@@ static struct block_device *ext4_get_jo
  	ext4_fsblk_t sb_block;
  	unsigned long offset;
  	struct ext4_super_block *es;
 -	struct block_device *bdev;
 -
 -	if (WARN_ON_ONCE(!ext4_has_feature_journal(sb)))
 -		return NULL;
 +	int errno;
  
+ 	/* see get_tree_bdev why this is needed and safe */
+ 	up_write(&sb->s_umount);
 -	bdev = ext4_blkdev_get(j_dev, sb);
 +	bdev = blkdev_get_by_dev(j_dev, BLK_OPEN_READ | BLK_OPEN_WRITE, sb,
 +				 &ext4_holder_ops);
+ 	down_write(&sb->s_umount);
 -	if (bdev == NULL)
 -		return NULL;
 +	if (IS_ERR(bdev)) {
 +		ext4_msg(sb, KERN_ERR,
 +			 "failed to open journal device unknown-block(%u,%u) %ld",
 +			 MAJOR(j_dev), MINOR(j_dev), PTR_ERR(bdev));
 +		return ERR_CAST(bdev);
 +	}
  
  	blocksize = sb->s_blocksize;
  	hblock = bdev_logical_block_size(bdev);