]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
change_mnt_propagation(): calculate propagation source only if we'll need it
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 15 Aug 2025 19:23:08 +0000 (15:23 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 19 Aug 2025 16:05:59 +0000 (12:05 -0400)
We only need it when mount in question was sending events downstream (then
recepients need to switch to new master) or the mount is being turned into
slave (then we need a new master for it).

That wouldn't be a big deal, except that it causes quite a bit of work
when umount_tree() is taking a large peer group out.  Adding a trivial
"don't bother calling propagation_source() unless we are going to use
its results" logics improves the things quite a bit.

We are still doing unnecessary work on bulk removals from propagation graph,
but the full solution for that will have to wait for the next merge window.

Fixes: 955336e204ab "do_make_slave(): choose new master sanely"
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/pnode.c

index 1c789f88b3d26c7ad5a84918691829f537eea5e2..6f7d02f3fa985f7ec335c0f59b17cf9f82743689 100644 (file)
@@ -111,7 +111,8 @@ void change_mnt_propagation(struct mount *mnt, int type)
                return;
        }
        if (IS_MNT_SHARED(mnt)) {
-               m = propagation_source(mnt);
+               if (type == MS_SLAVE || !hlist_empty(&mnt->mnt_slave_list))
+                       m = propagation_source(mnt);
                if (list_empty(&mnt->mnt_share)) {
                        mnt_release_group_id(mnt);
                } else {