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

From: Stephen Rothwell <[email-masked]>
Date: Fri, 5 Sep 2025 09:48:34 +1000

Hi all,

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

  fs/namespace.c

between commits:

  807602d8cfc8 ("vfs: output mount_too_revealing() errors to fscontext")
  1e5f0fb41fcc ("vfs: fs/namespace.c: remove ms_flags argument from do_remount")

from the vfs_brauner tree and commits:

  5423426a79dd ("switch do_new_mount_fc() to fc_mount()")
  308a022f41bd ("do_new_mount_fc(): use __free() to deal with dropping mnt on failure")
  ead5706f63cd ("do_{loopback,change_type,remount,reconfigure_mnt}(): constify struct path argument")

from the vfs 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/namespace.c
index 92980f758fd4,aeeb33bf3e7b..000000000000
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@@ -3298,7 -3310,7 +3319,7 @@@ static int do_reconfigure_mnt(const str
   * If you've mounted a non-root directory somewhere and want to do remount
   * on it - tough luck.
   */
- static int do_remount(struct path *path, int sb_flags,
 -static int do_remount(const struct path *path, int ms_flags, int sb_flags,
++static int do_remount(const struct path *path, int sb_flags,
  		      int mnt_flags, void *data)
  {
  	int err;
@@@ -3738,30 -3720,20 +3729,22 @@@ static int do_new_mount_fc(struct fs_co
  	if (IS_ERR(mnt))
  		return PTR_ERR(mnt);
  
+ 	sb = fc->root->d_sb;
+ 	error = security_sb_kern_mount(sb);
+ 	if (unlikely(error))
+ 		return error;
+ 
 -	if (unlikely(mount_too_revealing(sb, &mnt_flags)))
++	if (unlikely(mount_too_revealing(sb, &mnt_flags))) {
++		errorfcp(fc, "VFS", "Mount too revealing");
+ 		return -EPERM;
++	}
+ 
  	mnt_warn_timestamp_expiry(mountpoint, mnt);
  
- 	error = lock_mount(mountpoint, &mp);
- 	if (!error) {
- 		error = do_add_mount(real_mount(mnt), mp.mp,
- 				     mountpoint, mnt_flags);
- 		unlock_mount(&mp);
- 	}
- 	if (error < 0)
- 		mntput(mnt);
+ 	LOCK_MOUNT(mp, mountpoint);
+ 	error = do_add_mount(real_mount(mnt), &mp, mnt_flags);
+ 	if (!error)
+ 		retain_and_null_ptr(mnt); // consumed on success
  	return error;
  }