diff options
author | Christian Brauner <brauner@kernel.org> | 2025-02-21 14:13:01 +0100 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2025-03-04 09:29:52 +0100 |
commit | 2f576220cd8129a303ef4bac4b08e3937c42eff8 (patch) | |
tree | 1558f134d87138864e402ad6085a2287a735f5bb /fs/namespace.c | |
parent | 3b0cdba4da55188b8ae49430f2730fade56b43ae (diff) |
fs: add mnt_ns_empty() helper
Add a helper that checks whether a give mount namespace is empty instead
of open-coding the specific data structure check. This also be will be
used in follow-up patches.
Link: https://lore.kernel.org/r/20250221-brauner-open_tree-v1-2-dbcfcb98c676@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index d5c85b6ecb98..8ca28737f4ee 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -5315,7 +5315,7 @@ static int grab_requested_root(struct mnt_namespace *ns, struct path *root) * We have to find the first mount in our ns and use that, however it * may not exist, so handle that properly. */ - if (RB_EMPTY_ROOT(&ns->mounts)) + if (mnt_ns_empty(ns)) return -ENOENT; first = child = ns->root; @@ -5340,7 +5340,7 @@ static int do_statmount(struct kstatmount *s, u64 mnt_id, u64 mnt_ns_id, int err; /* Has the namespace already been emptied? */ - if (mnt_ns_id && RB_EMPTY_ROOT(&ns->mounts)) + if (mnt_ns_id && mnt_ns_empty(ns)) return -ENOENT; s->mnt = lookup_mnt_in_ns(mnt_id, ns); |