Sample the current rcu state and kick off a new grace period after we're done with umount_tree() and make namespace_unlock() take the previous state into account before invoking synchronize_rcu_expedited(). Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx> --- fs/namespace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/namespace.c b/fs/namespace.c index d9ca80dcc544..287189e85af5 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -77,6 +77,7 @@ static struct hlist_head *mount_hashtable __ro_after_init; static struct hlist_head *mountpoint_hashtable __ro_after_init; static struct kmem_cache *mnt_cache __ro_after_init; static DECLARE_RWSEM(namespace_sem); +static struct rcu_gp_oldstate rcu_unmount_gp; static HLIST_HEAD(unmounted); /* protected by namespace_sem */ static LIST_HEAD(ex_mountpoints); /* protected by namespace_sem */ static DEFINE_SEQLOCK(mnt_ns_tree_lock); @@ -1817,7 +1818,7 @@ static void namespace_unlock(void) if (likely(hlist_empty(&head))) return; - synchronize_rcu_expedited(); + cond_synchronize_rcu_expedited_full(&rcu_unmount_gp); hlist_for_each_entry_safe(m, p, &head, mnt_umount) { hlist_del(&m->mnt_umount); @@ -1939,6 +1940,9 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how) */ mnt_notify_add(p); } + + /* Record current grace period state and kick of new grace period. */ + start_poll_synchronize_rcu_expedited_full(&rcu_unmount_gp); } static void shrink_submounts(struct mount *mnt); -- 2.47.2 --wlvjtn7bxagetzkl--