public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>
Subject: linux-next: manual merge of the vfs tree with the vfs-brauner tree
Date: Wed, 24 Sep 2025 11:04:04 +0200	[thread overview]
Message-ID: <aNO0BKAXphoFEgUk@finisterre.sirena.org.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 4162 bytes --]

Hi all,

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

  fs/namespace.c

between commit:

  59bfb66816809 ("listmount: don't call path_put() under namespace semaphore")

from the vfs-brauner tree and commit:

  2aec880c1cdf1 ("path_is_under(): use guards")

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.

diff --cc fs/namespace.c
index ef64472c4e15b,b9430a5cc987f..0000000000000
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@@ -90,7 -80,16 +90,15 @@@ static DECLARE_RWSEM(namespace_sem)
  static HLIST_HEAD(unmounted);	/* protected by namespace_sem */
  static LIST_HEAD(ex_mountpoints); /* protected by namespace_sem */
  static struct mnt_namespace *emptied_ns; /* protected by namespace_sem */
 -static DEFINE_SEQLOCK(mnt_ns_tree_lock);
  
+ static inline void namespace_lock(void);
+ static void namespace_unlock(void);
+ DEFINE_LOCK_GUARD_0(namespace_excl, namespace_lock(), namespace_unlock())
+ DEFINE_LOCK_GUARD_0(namespace_shared, down_read(&namespace_sem),
+ 				      up_read(&namespace_sem))
+ 
+ DEFINE_FREE(mntput, struct vfsmount *, if (!IS_ERR(_T)) mntput(_T))
+ 
  #ifdef CONFIG_FSNOTIFY
  LIST_HEAD(notify_list); /* protected by namespace_sem */
  #endif
@@@ -3229,7 -3304,7 +3244,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;
@@@ -4205,14 -4241,7 +4170,7 @@@ struct mnt_namespace *copy_mnt_ns(u64 f
  		while (p->mnt.mnt_root != q->mnt.mnt_root)
  			p = next_mnt(skip_mnt_tree(p), old);
  	}
- 	namespace_unlock();
- 
- 	if (rootmnt)
- 		mntput(rootmnt);
- 	if (pwdmnt)
- 		mntput(pwdmnt);
- 
 -	mnt_ns_tree_add(new_ns);
 +	ns_tree_add_raw(new_ns);
  	return new_ns;
  }
  
@@@ -5897,22 -5900,12 +5827,23 @@@ retry
  	return ret;
  }
  
 +struct klistmount {
 +	u64 last_mnt_id;
 +	u64 mnt_parent_id;
 +	u64 *kmnt_ids;
 +	u32 nr_mnt_ids;
 +	struct mnt_namespace *ns;
 +	struct path root;
 +};
 +
+ /* locks: namespace_shared */
 -static ssize_t do_listmount(struct mnt_namespace *ns, u64 mnt_parent_id,
 -			    u64 last_mnt_id, u64 *mnt_ids, size_t nr_mnt_ids,
 -			    bool reverse)
 +static ssize_t do_listmount(struct klistmount *kls, bool reverse)
  {
 -	struct path root __free(path_put) = {};
 +	struct mnt_namespace *ns = kls->ns;
 +	u64 mnt_parent_id = kls->mnt_parent_id;
 +	u64 last_mnt_id = kls->last_mnt_id;
 +	u64 *mnt_ids = kls->kmnt_ids;
 +	size_t nr_mnt_ids = kls->nr_mnt_ids;
  	struct path orig;
  	struct mount *r, *first;
  	ssize_t ret;
@@@ -6040,8 -6012,9 +5971,8 @@@ SYSCALL_DEFINE4(listmount, const struc
  	 * We only need to guard against mount topology changes as
  	 * listmount() doesn't care about any mount properties.
  	 */
- 	scoped_guard(rwsem_read, &namespace_sem)
+ 	scoped_guard(namespace_shared)
 -		ret = do_listmount(ns, kreq.mnt_id, last_mnt_id, kmnt_ids,
 -				   nr_mnt_ids, (flags & LISTMOUNT_REVERSE));
 +		ret = do_listmount(&kls, (flags & LISTMOUNT_REVERSE));
  	if (ret <= 0)
  		return ret;
  
@@@ -6124,14 -6093,12 +6055,12 @@@ void __init mnt_init(void
  
  void put_mnt_ns(struct mnt_namespace *ns)
  {
 -	if (!refcount_dec_and_test(&ns->ns.count))
 +	if (!ns_ref_put(ns))
  		return;
- 	namespace_lock();
+ 	guard(namespace_excl)();
  	emptied_ns = ns;
- 	lock_mount_hash();
+ 	guard(mount_writer)();
  	umount_tree(ns->root, 0);
- 	unlock_mount_hash();
- 	namespace_unlock();
  }
  
  struct vfsmount *kern_mount(struct file_system_type *type)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2025-09-24  9:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-24  9:04 Mark Brown [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-04-08 12:43 linux-next: manual merge of the vfs tree with the vfs-brauner tree Mark Brown
2026-04-08 17:16 ` Al Viro
2026-04-08 17:32   ` Mark Brown
2026-01-19 13:45 Mark Brown
2026-01-14 22:38 Stephen Rothwell
2025-11-20 21:47 Stephen Rothwell
2025-11-20 21:42 Stephen Rothwell
2025-11-20 21:33 Stephen Rothwell
2025-11-20 21:27 Stephen Rothwell
2025-09-25 12:35 Mark Brown
2025-09-24  8:58 Mark Brown
2025-09-22  8:58 Mark Brown
2025-09-04 23:48 Stephen Rothwell
2025-07-07 23:38 Stephen Rothwell
2025-07-08  0:25 ` Al Viro
2025-07-08  0:45   ` Al Viro
2025-07-08  8:15     ` Christian Brauner
2025-05-16  0:02 Stephen Rothwell
2025-01-19 23:41 Stephen Rothwell
2025-01-20  9:21 ` David Howells
2023-12-19 23:41 Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aNO0BKAXphoFEgUk@finisterre.sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=brauner@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox