here a use of __free(path_put) for dropping fs_root is enough to make guard(mount_locked_reader) fit... Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx> --- fs/namespace.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 107da30b408c..a8b586e635d8 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -6195,23 +6195,20 @@ bool our_mnt(struct vfsmount *mnt) bool current_chrooted(void) { /* Does the current process have a non-standard root */ - struct mount *root = current->nsproxy->mnt_ns->root; - struct path fs_root; - bool chrooted; + struct path fs_root __free(path_put) = {}; + struct mount *root; get_fs_root(current->fs, &fs_root); /* Find the namespace root */ - read_seqlock_excl(&mount_lock); + guard(mount_locked_reader)(); + + root = current->nsproxy->mnt_ns->root; while (unlikely(root->overmount)) root = root->overmount; - chrooted = fs_root.mnt != &root->mnt || !path_mounted(&fs_root); - - read_sequnlock_excl(&mount_lock); - path_put(&fs_root); - return chrooted; + return fs_root.mnt != &root->mnt || !path_mounted(&fs_root); } static bool mnt_already_visible(struct mnt_namespace *ns, -- 2.47.2