From nobody Wed Dec 17 15:53:46 2025 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A71AB3112B7 for ; Thu, 2 Oct 2025 12:55:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759409735; cv=none; b=uMXnaPh6+VbeD7eQWrUh6cKbd5yOrBDNSznOq8ZcqdAHECc85StDY8tB0EmRDEJj2Il1JMUKBgOwSKEM3UarRgkAGBX6nRznBtYi3duj7/QC6DpwX36IWbNYAQy9OgAJyqJP5tc83rBvypr+qTpaHEqcMRIZcCwCZMrLOMYv0vQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759409735; c=relaxed/simple; bh=bBoPByU0u+Zox2711PmvFaMUe787bDzh8gdKqG+iuX4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MoE4wv1R7cii3nmMcgcejN2LZVtcvb2DJYybeM8H1Mrl3eppgFD73X2KkWyRJizgZgO/TMKk+pzTbkUadagpxB/fW4PXCCwyLYpZFy//jlpk1WhAANiP3G909cq9x4UcZVSJN7amSYjq9+cduS/iDejLbMpYYu2kt7KuOzh/F/I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gr+l6Os9; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gr+l6Os9" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-7811a02316bso777387b3a.3 for ; Thu, 02 Oct 2025 05:55:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759409733; x=1760014533; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FZnL+H7vxHEMgbhRqepsLGLcPNeyBbhnobl0F6exUMM=; b=gr+l6Os9n30Qbt5URAwCsMoOKLPuYq0O+Upj66H/9iI6DZbBjRifZJ2a/DHfk4kKDl sEN1k5crBD58tcibf8mYdqgP4FDL1wD6j08yk2VK4+9Ile3X/VOcNHkBsoysE+iW3FMr KSTf4o4uKWjea0ZJX4bTGoqMiPi3KxoHAREfuHdK4SdpVPbK59bRWa05Oo+lMXktujFE /yTdBGSYNPw2mmWuzgOqO4fxOQ9pnW3lcRM6/X9GvFj7DkqyE4yRj7zFmz8b4KJ0pg0u PQdN3QODWZtfm2jwjdGdXJ4wzTRrdszj5yunGmqU5Q3/W3TdmOuKQNfgFQEDgq6M/eEF ks3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759409733; x=1760014533; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FZnL+H7vxHEMgbhRqepsLGLcPNeyBbhnobl0F6exUMM=; b=wNKTAPPbHSs/582OzPvKhqfASg4H6WGkgxmk0peo3nl7H+KdPOFj9OgVWPYUyUepcS B1hXQWvTJAQCBMNoSyFLR3GaRHIBEZZs9OgSB8H7sw/xxNN8GGToNYYlomSO/Q26IEti QDHGgswgNAq5V6DYAPg924ISecB62NID7+2vz4hvN6gT24ScVVd2qsTTvPRHZpsrBGTA Z9RcqBmLE6sDMsjzVU/U65SJTp1FPzlIvlbEbPd0ru3WsOcpAfuHQpp/9P6uJuLCKMum ElwVtOz7iDTtTDgnsDeKxgMrxOuwdlAFDORWkM+KoTGR1fVQeo/VnyARZdB9QclCM3+V mGAA== X-Forwarded-Encrypted: i=1; AJvYcCWaB9nhlORPVnsJqPl22v2GaUyAUIMvpOls3bSKoVDU44QuJFSzJinVj7PNVD/QPycyrrQGOli3WS6BDEo=@vger.kernel.org X-Gm-Message-State: AOJu0Yx1R1bk5dsjlnQ1as9L0EBY7K3RNnD+iuD0x7L6BvIB/tjXC4/W qFJ9WyUv2vOpSHrOiHGT51E12EmTVWcFZe1EyzgkGtUmpLiRqgbsxdVy X-Gm-Gg: ASbGncvLbtK4lBj2fmP5PViNPQ7Si4Myq3ff3C3wZD/dmwkSma/LFDolD7PldD4Cwqo 7xqhFgNu+id4JzRy0hbuWjaB3iI6xCyn2337ViSBdRYeLpRDuO1QmqWGqmrX1LAil+Qw+WzPtj0 p/W5bMJohTLS5a9lLMnoA0A7nm1e90Wdm+BQz4eKkjPKRdqdJ2G2Y/JletkizbsDXG7rxCYVGNh PNDmanEaWPL8yO4BJDgFgYZJ454th9+65hbb3NcY/ioAYtcCfvfaLBb982vGhCY/5UjKhR8F2iP /TYUM6IEURL+u/vUqdkqzp0FHT+Zj4NwZ1eu+/kKHdSRKZAgJmeg4J8t7FqQCCTQtDE+VE1olks 2X3hD+4eTXsPK7PBAPgBSC5Dq6RjHanHj2bf5U0maJ1dT2bLd7UAaYTDohA== X-Google-Smtp-Source: AGHT+IHQERmfs2RD78TSJO1M4xWw3jZsSBvgjQ16GqqTIwVJMEmNueVgzhZUrDF50m3mwbjFfRlmmA== X-Received: by 2002:a05:6a00:bb0e:b0:781:2538:bfb4 with SMTP id d2e1a72fcca58-78af3ffb4demr7059773b3a.10.1759409732860; Thu, 02 Oct 2025 05:55:32 -0700 (PDT) Received: from fedora ([2405:201:3017:a80:9e5c:2c74:b73f:890a]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-78b01f9a2b9sm2165556b3a.19.2025.10.02.05.55.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Oct 2025 05:55:32 -0700 (PDT) From: Bhavik Sachdev To: Alexander Viro , Christian Brauner Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Aleksa Sarai , Bhavik Sachdev , Pavel Tikhomirov , Jan Kara , John Garry , Arnaldo Carvalho de Melo , "Darrick J . Wong" , Namhyung Kim , Ingo Molnar , Andrei Vagin , Alexander Mikhalitsyn Subject: [PATCH 1/4] fs/namespace: add umount_mnt_ns mount namespace for unmounted mounts Date: Thu, 2 Oct 2025 18:18:37 +0530 Message-ID: <20251002125422.203598-2-b.sachdev1904@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251002125422.203598-1-b.sachdev1904@gmail.com> References: <20251002125422.203598-1-b.sachdev1904@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pavel Tikhomirov We would like the ability to get mount info for mounts that have been "unmounted" but still have open fds (umount2(mnt, MNT_DETACH)). This patch introduces a new umount_mnt_ns to which these "unmounted" mounts will be moved to instead of their mount namespaces being NULL. We add this umount_mnt_ns to init_userns so all "umounted" mounts are accessible via root userns only. Signed-off-by: Pavel Tikhomirov --- fs/namespace.c | 14 ++++++++++++++ include/linux/proc_ns.h | 1 + include/uapi/linux/nsfs.h | 1 + 3 files changed, 16 insertions(+) diff --git a/fs/namespace.c b/fs/namespace.c index ae6d1312b184..70fe01d810df 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -107,6 +107,9 @@ struct mount_kattr { struct kobject *fs_kobj __ro_after_init; EXPORT_SYMBOL_GPL(fs_kobj); =20 +struct mnt_namespace *umount_mnt_ns __ro_after_init; +EXPORT_SYMBOL_GPL(umount_mnt_ns); + /* * vfsmount lock may be taken for read to prevent changes to the * vfsmount hash, ie. during mountpoint lookups or walking back @@ -6121,6 +6124,17 @@ static void __init init_mount_tree(void) set_fs_root(current->fs, &root); =20 mnt_ns_tree_add(ns); + + umount_mnt_ns =3D alloc_mnt_ns(&init_user_ns, true); + if (IS_ERR(umount_mnt_ns)) { + free_mnt_ns(ns); + panic("Can't allocate initial umount namespace"); + } + umount_mnt_ns->seq =3D atomic64_inc_return(&mnt_ns_seq); + umount_mnt_ns->seq_origin =3D ns->seq; + umount_mnt_ns->ns.inum =3D PROC_UMNT_INIT_INO; + + mnt_ns_tree_add(umount_mnt_ns); } =20 void __init mnt_init(void) diff --git a/include/linux/proc_ns.h b/include/linux/proc_ns.h index 4b20375f3783..c1e8edba862d 100644 --- a/include/linux/proc_ns.h +++ b/include/linux/proc_ns.h @@ -48,6 +48,7 @@ enum { PROC_TIME_INIT_INO =3D TIME_NS_INIT_INO, PROC_NET_INIT_INO =3D NET_NS_INIT_INO, PROC_MNT_INIT_INO =3D MNT_NS_INIT_INO, + PROC_UMNT_INIT_INO =3D UMNT_NS_INIT_INO, }; =20 #ifdef CONFIG_PROC_FS diff --git a/include/uapi/linux/nsfs.h b/include/uapi/linux/nsfs.h index 97d8d80d139f..8bb0df8954bb 100644 --- a/include/uapi/linux/nsfs.h +++ b/include/uapi/linux/nsfs.h @@ -51,6 +51,7 @@ enum init_ns_ino { TIME_NS_INIT_INO =3D 0xEFFFFFFAU, NET_NS_INIT_INO =3D 0xEFFFFFF9U, MNT_NS_INIT_INO =3D 0xEFFFFFF8U, + UMNT_NS_INIT_INO =3D 0xEFFFFFF7U, }; =20 #endif /* __LINUX_NSFS_H */ --=20 2.51.0 From nobody Wed Dec 17 15:53:46 2025 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF1F13112B7 for ; Thu, 2 Oct 2025 12:55:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759409743; cv=none; b=MjPDqhdPs92679tPf5ZN2REvluhnfwJWAMvObYm/W52yJYyon0Wzm2G2IigkQvT9Mt0GQxVAXVOtdE25avHhsYELiQnla7VMhmJRzpMlQ++fxOziJKvwW7DMzO8Rv4xzXZIFtq9qrOtWVsmA4e9UL7QWSrq2s0RxxbffcCsQRQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759409743; c=relaxed/simple; bh=wYXddcwvRcQeKAEy9A1oIWjRBhIg8md5Wu6+CeCI49E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dgNzK5lrKKRV22t/oHr9GwRoBUUJ18z/BmHx06p+wYClFh7CKAvbhhb7So9TxVRMV7+eCg9DKrUD0hKnwqEOupMRphduyH19hYeAStBoGbVYhIIvqGOKyXZ5SHWi3yesAtnvAqKD9MzhS9Qbku4t8Ud3uMe2ePucc/qu5GhVI6Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=NGQMcLus; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NGQMcLus" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-7833765433cso1519068b3a.0 for ; Thu, 02 Oct 2025 05:55:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759409741; x=1760014541; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EJxtmpcoXc4yrgHs5WtTE6sBIdXe4Bd5IXbrrNjT5jw=; b=NGQMcLusDd/Trjo4v/ZCJyD5L6xV8SQsCX3YmeSXaTk8TgIbI0cDmxoda2ObY4av2o O0XocLzHvtPpRa2Ff5Go4t61EUDF+QbwQ1OL3/SrWJDq/eAd7wmO5IrJUALFkE2lWIq2 FLL8XSeLYKlKOqyKgMTCAeE4VSU1SdJXt+7ZbL1BeM6d76bF5fQ97dLd17gi3nYi826A bRseLqLBxScAOV6+JG5cD04DDnX+8e4k2iQYUO3qN8gXPFKYhLWk3Omi4gn9CFYnQjSZ nbr4zf7WZ3D/fK5P3KNn+J5MFtsnLIS4Jzdib6ZuQVgrehDyKPxNYhgZNHfwwJ7q/m60 2qRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759409741; x=1760014541; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EJxtmpcoXc4yrgHs5WtTE6sBIdXe4Bd5IXbrrNjT5jw=; b=b8rIqTwjXcSJjr/G3dQaBRYXwCgnY0uQenFN4lioZYE1/dmCQuo7DgPRo0+k/5STuS 42Tw05PGcx3DG/yvLIKIO7BkODRggfcY0nAy3N6F/+b04H0+KPAGC6ses2wWYoKlPIEJ Tm/yqbmQZXRz50eQbUvKK8z1zdj4NU2NnvlADlC1zH/rQD1ASJ59mr0z0uJAF/cHeka2 tCumi9GuVph6zuifvDGe6qyqaE3QcCgb+kbv86ciWQsjZ4VM5+05PY7TAKsEsfLMAtjG OtwGhP0KN26wFVJC9mPHsDno84hbTXbmT/0909GYRlNJpDPaGJ3TDaSizHQNwc5pAJwZ dwkw== X-Forwarded-Encrypted: i=1; AJvYcCVkIP3c6Z5pKYdwlYIK5wipwhispm1A476Rs9e4vuL9/7eO/9ETtmcNxPjE9zsNrZUBrZwztoonYE6HMdc=@vger.kernel.org X-Gm-Message-State: AOJu0YyKzAtYixhlCcoG6OiBdmfypeEQMcire/NugdY2Oq5EzsJdnKwm ixYZTxXRp1GGTgba9rNyPJhUFPMzxriau0+kuYrdOkVncuoH+b7a0Lf/ X-Gm-Gg: ASbGncusJftAPNZwAOXCyB2KnAp1Ft0cuWzGYnemYAsDtyYelJMtfIU42w9QGbKNImY PtqVC2srxEPNhtkCekij8NaOzTJ/B8jfo7fdqYrVLHQ3Xq+JP8hweLh9fLJWgqwVn13iOw+zUyk AqBcgYXhsGn0GWEELmoOpW9XE3UFVN+axM41+fMuqVWjAbRSIvl+eSTAQHpNP6AGns4zBEwKPM1 rT+Yv+YuCnBr8bbFZPT+K/lN1N3kbUvbYwJ6pzqKioRa1LSfoXLCobgGiK8gKiljO4CBjXGV8z2 kSRy3+Ati4726YfZFRAaOgNkRL4wzxRJK6k0pZysYZzf0DOlp/dC0z6k0FALT1y4HbS73HAPf/c C0WivgI9rHk6Nuzvd+cI1aV5KTg4KQ4cqNbq0+OE7C4CeY7s= X-Google-Smtp-Source: AGHT+IHFaqJGan1kbBL1yPFJipQm5sq8pkjRSeMRc0bigutWIseqQVBU2KqOXs5f++yqM/U9uhcYVQ== X-Received: by 2002:a05:6a00:1884:b0:776:20c2:d58b with SMTP id d2e1a72fcca58-78af4209966mr9210619b3a.24.1759409740920; Thu, 02 Oct 2025 05:55:40 -0700 (PDT) Received: from fedora ([2405:201:3017:a80:9e5c:2c74:b73f:890a]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-78b01f9a2b9sm2165556b3a.19.2025.10.02.05.55.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Oct 2025 05:55:40 -0700 (PDT) From: Bhavik Sachdev To: Alexander Viro , Christian Brauner Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Aleksa Sarai , Bhavik Sachdev , Pavel Tikhomirov , Jan Kara , John Garry , Arnaldo Carvalho de Melo , "Darrick J . Wong" , Namhyung Kim , Ingo Molnar , Andrei Vagin , Alexander Mikhalitsyn Subject: [PATCH 2/4] fs/namespace: add umounted mounts to umount_mnt_ns Date: Thu, 2 Oct 2025 18:18:38 +0530 Message-ID: <20251002125422.203598-3-b.sachdev1904@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251002125422.203598-1-b.sachdev1904@gmail.com> References: <20251002125422.203598-1-b.sachdev1904@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pavel Tikhomirov This patch add "unmounted" mounts to umount_mnt_ns instead of mount namespace being NULL for such mounts. This will allow us to later use statmount to get mount info about these mounts. We also introduce proper checks so that "unmounted" mounts are still detected correctly. We delete mounts from umount_mnt_ns when no references to them exist. Signed-off-by: Pavel Tikhomirov --- fs/d_path.c | 2 +- fs/mount.h | 10 +++++++++- fs/namespace.c | 23 ++++++++++++++++++++--- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/fs/d_path.c b/fs/d_path.c index bb365511066b..c6a4118899e1 100644 --- a/fs/d_path.c +++ b/fs/d_path.c @@ -119,7 +119,7 @@ static int __prepend_path(const struct dentry *dentry, = const struct mount *mnt, /* Global root */ mnt_ns =3D READ_ONCE(mnt->mnt_ns); /* open-coded is_mounted() to use local mnt_ns */ - if (!IS_ERR_OR_NULL(mnt_ns) && !is_anon_ns(mnt_ns)) + if (!IS_ERR_OR_NULL(mnt_ns) && !is_anon_ns(mnt_ns) && !is_umount_ns(mnt= _ns)) return 1; // absolute root else return 2; // detached or not attached yet diff --git a/fs/mount.h b/fs/mount.h index 97737051a8b9..03f8165939b4 100644 --- a/fs/mount.h +++ b/fs/mount.h @@ -122,10 +122,18 @@ static inline int mnt_has_parent(const struct mount *= mnt) return mnt !=3D mnt->mnt_parent; } =20 +extern struct mnt_namespace *umount_mnt_ns; + +static inline bool is_umount_ns(struct mnt_namespace *ns) +{ + return ns =3D=3D umount_mnt_ns; +} + static inline int is_mounted(struct vfsmount *mnt) { + struct mnt_namespace *ns =3D READ_ONCE(real_mount(mnt)->mnt_ns); /* neither detached nor internal? */ - return !IS_ERR_OR_NULL(real_mount(mnt)->mnt_ns); + return !IS_ERR_OR_NULL(ns) && !is_umount_ns(ns); } =20 extern struct mount *__lookup_mnt(struct vfsmount *, struct dentry *); diff --git a/fs/namespace.c b/fs/namespace.c index 70fe01d810df..0b4be12c02de 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1016,7 +1016,7 @@ static inline bool check_anonymous_mnt(struct mount *= mnt) { u64 seq; =20 - if (!is_anon_ns(mnt->mnt_ns)) + if (!is_anon_ns(mnt->mnt_ns) || is_umount_ns(mnt->mnt_ns)) return false; =20 seq =3D mnt->mnt_ns->seq_origin; @@ -1400,9 +1400,11 @@ static void mntput_no_expire(struct mount *mnt) { LIST_HEAD(list); int count; + struct mnt_namespace *ns; =20 rcu_read_lock(); - if (likely(READ_ONCE(mnt->mnt_ns))) { + ns =3D READ_ONCE(mnt->mnt_ns); + if (likely(ns && !is_umount_ns(ns))) { /* * Since we don't do lock_mount_hash() here, * ->mnt_ns can change under us. However, if it's @@ -1438,6 +1440,18 @@ static void mntput_no_expire(struct mount *mnt) mnt->mnt.mnt_flags |=3D MNT_DOOMED; rcu_read_unlock(); =20 + if (mnt_ns_attached(mnt)) { + struct mnt_namespace *ns; + + move_from_ns(mnt); + ns =3D mnt->mnt_ns; + if (ns) { + ns->nr_mounts--; + __touch_mnt_namespace(ns); + } + mnt->mnt_ns =3D NULL; + } + list_del(&mnt->mnt_instance); if (unlikely(!list_empty(&mnt->mnt_expire))) list_del(&mnt->mnt_expire); @@ -1885,6 +1899,9 @@ static void umount_tree(struct mount *mnt, enum umoun= t_tree_flags how) * namespace, etc. */ mnt_notify_add(p); + + mnt_add_to_ns(umount_mnt_ns, p); + umount_mnt_ns->nr_mounts++; } } =20 @@ -4804,7 +4821,7 @@ static int can_idmap_mount(const struct mount_kattr *= kattr, struct mount *mnt) return -EPERM; =20 /* Mount has already been visible in the filesystem hierarchy. */ - if (!is_anon_ns(mnt->mnt_ns)) + if (!is_anon_ns(mnt->mnt_ns) || is_umount_ns(mnt->mnt_ns)) return -EINVAL; =20 return 0; --=20 2.51.0 From nobody Wed Dec 17 15:53:46 2025 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 625FA311957 for ; Thu, 2 Oct 2025 12:55:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759409750; cv=none; b=bfhGAKTudAirjhWUNjoosuKc+EGziDtLnafyYlbYKZ0ugKbM0+5ZgW6vz67H33E8anYOGR8LO7EdBUxCnfbhZzbQHYqIFNDBzHx/YvJaUkmyIguYKGR8Nz44UZfYOd+kj2FKJ8vDw6aD0Y4BF5dVp6WVYQ1WMu0itg350FCL4o0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759409750; c=relaxed/simple; bh=fak1x7u6QjeJLvthEEWVG8U8+j2kAQGpv7pJ0KElavg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Gom79/X41SSF0o4uDhZ8RwXX3bUR0V6c7yLAD2k5qXS1opw8O5T1jdRqlPPHJ6c3IK2Fb3noT0mFCEniGrkj3aw2O0cAV+olJkuf7gy6erhnaRFjOUZeW69XQT3Pckk6JCTVOsP9T0dTVS8NMr6LTKbDLF+/DG5asyV5Pthg53o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dhl9EF9F; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dhl9EF9F" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-77f605f22easo1032587b3a.2 for ; Thu, 02 Oct 2025 05:55:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759409749; x=1760014549; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QJKixBnmE478kGZ+GgFsDt+ITdYACcgY7ioQS8r/oGI=; b=dhl9EF9FwUKUnmtTaj21fF+rKEq1ZT3x9Lo9Me7HtOjocW6eEuXKFYCiXs9xr9fINF qjQY1VPcGwMgETi+Ijb0OOeRzsM9f7ZxWXUMm79oXpw/UwAwvVMogQFgllYs1GsOD7EM MErO1Q8aYno/5EMlr7ZnNIdI+Ir66o+2FYQeFKoVAIjC9tWOaUfXQ54nNwlF0cUCYgWk 1ESeAevyq2Kf7+7G7GYUxOx2kV7BN4l/rUAhFIn8M6a8B1J2AK5si6Ymt4v4/9H560xF ruD4M1FelN3IJQX9a550gSB5T6IrSK9Dq7e+vSIkUAjFfB9BvmQurLpDp+6OcxdB3wMM zi8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759409749; x=1760014549; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QJKixBnmE478kGZ+GgFsDt+ITdYACcgY7ioQS8r/oGI=; b=e4eRgpnoM+6jM5N4BdYcYKXCPfT28Ys85NlDxLheIoZnn3YkM2tAG9ZgcDkUGzl07g c8+X5B9WW01Ui1e1j9pShroL0N0YM512PArL1U6YKMOH94oTj9On3eRZ35CB7xn0huIT 4evjWTd3GXH407vMs6J57M2YT4Q6XiQgNVMFm/V7Pd6O8/2nOlV9GDA/VMck88KT5VMQ Bp/tr/QOrGiCgG6tQq0qtwQXB1GNqfQ3iyiKYTQe7Bs7X3y9HhIULYLDh0R+Fa6Twvbu 64UIeCQWtSVNDlqylIrAG0UqC5g/5/JP0SufXdgIhXNopQMOmO+VqpplIyI3vnbJnjca ftNQ== X-Forwarded-Encrypted: i=1; AJvYcCXT9F9HWSImjSckcT/p8pt0AxrfxX1L+cGPmM9rR/Mfe01TOa1ykqCdfZ0d6vN/61FHUKwj79UkZ4vG1+I=@vger.kernel.org X-Gm-Message-State: AOJu0YybaIBZy8218MZ4Ng+CFLvBNEPWYcObiLSdvQYi9QN8HiMZEcR0 IJkhZCMVuJVAM/aJZaMXJDmzWs3GuhbgjQWp0mOXRTH++bNQxdbLaIHY X-Gm-Gg: ASbGnctrTsqonLS3wNApxjjDs3px4uLGbvDGIaE3Ib+yq1Nxu/K6a7l4bLoLrM00Ovo zp0MlW+QPlbcDGmDvKhougSt6TOmHKWj8KTpBe07RFnBGdWPlpYXVQnKu5/B3GompUBniOKu95U JcSLbs+wWswevYwXoDDJyIyNle761TTkvcU1MIwFufax8LeY5RF/uBpmQ30S8W/E+6Rbw/uWws4 dku+HdGeBc7LaPjL4qYwjhXAPAwvLERDaINZmCTEMlqabDyHmzfeF89enTf9KaEjnTVkcIVgk3U 68XvXGtUQ6PdjSl4A9IljRQJGt4ra4zwX0SFDEodLU1JuMMLQTxcZ23JOGSHfQYuX7aMpIfaPsY jsYKqF6hLV8ZCE4mfSidVGrogxbmMix7HrbEFhnad+WChWsQ= X-Google-Smtp-Source: AGHT+IEXlSEGCReTXDSDLwHVI1dX1cLJG7c7lxdNNuysBOzqp9JYRTzMQXY47Kt2ZLlng9HpZPzO6Q== X-Received: by 2002:a05:6a00:4f94:b0:780:f6db:b1af with SMTP id d2e1a72fcca58-78af420a72bmr7689110b3a.16.1759409748735; Thu, 02 Oct 2025 05:55:48 -0700 (PDT) Received: from fedora ([2405:201:3017:a80:9e5c:2c74:b73f:890a]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-78b01f9a2b9sm2165556b3a.19.2025.10.02.05.55.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Oct 2025 05:55:48 -0700 (PDT) From: Bhavik Sachdev To: Alexander Viro , Christian Brauner Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Aleksa Sarai , Bhavik Sachdev , Pavel Tikhomirov , Jan Kara , John Garry , Arnaldo Carvalho de Melo , "Darrick J . Wong" , Namhyung Kim , Ingo Molnar , Andrei Vagin , Alexander Mikhalitsyn Subject: [PATCH 3/4] statmount: allow for "unmounted" mounts Date: Thu, 2 Oct 2025 18:18:39 +0530 Message-ID: <20251002125422.203598-4-b.sachdev1904@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251002125422.203598-1-b.sachdev1904@gmail.com> References: <20251002125422.203598-1-b.sachdev1904@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" With "unmounted" mounts getting added to a separate umount_mnt_ns, we need special handling in statmount in order for it to work on "unmounted" mounts. unmount_mnt_ns has no root mount (it doesn't really make sense for it to have one) and "unmounted" mounts have no mountpoint. We handle both these things in statmount and output the mountpoint as "[detached]" in case of an "unmounted" mount. Signed-off-by: Bhavik Sachdev --- fs/namespace.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 0b4be12c02de..29d0e692b365 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -5365,6 +5365,12 @@ static int statmount_mnt_root(struct kstatmount *s, = struct seq_file *seq) return 0; } =20 +static int statmount_mnt_point_detached(struct kstatmount *s, struct seq_f= ile *seq) +{ + seq_puts(seq, "[detached]"); + return 0; +} + static int statmount_mnt_point(struct kstatmount *s, struct seq_file *seq) { struct vfsmount *mnt =3D s->mnt; @@ -5589,7 +5595,11 @@ static int statmount_string(struct kstatmount *s, u6= 4 flag) break; case STATMOUNT_MNT_POINT: offp =3D &sm->mnt_point; - ret =3D statmount_mnt_point(s, seq); + if (!s->root.mnt && !s->root.dentry) + /* detached mount case */ + ret =3D statmount_mnt_point_detached(s, seq); + else + ret =3D statmount_mnt_point(s, seq); break; case STATMOUNT_MNT_OPTS: offp =3D &sm->mnt_opts; @@ -5743,17 +5753,20 @@ static int do_statmount(struct kstatmount *s, u64 m= nt_id, u64 mnt_ns_id, if (!s->mnt) return -ENOENT; =20 - err =3D grab_requested_root(ns, &root); - if (err) - return err; + if (!is_umount_ns(ns)) { + err =3D grab_requested_root(ns, &root); + if (err) + return err; + } =20 /* * Don't trigger audit denials. We just want to determine what * mounts to show users. */ m =3D real_mount(s->mnt); - if (!is_path_reachable(m, m->mnt.mnt_root, &root) && - !ns_capable_noaudit(ns->user_ns, CAP_SYS_ADMIN)) + + if (!is_umount_ns(ns) && !is_path_reachable(m, m->mnt.mnt_root, &root) && + !ns_capable_noaudit(ns->user_ns, CAP_SYS_ADMIN)) return -EPERM; =20 err =3D security_sb_statfs(s->mnt->mnt_root); --=20 2.51.0 From nobody Wed Dec 17 15:53:46 2025 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D74863112D6 for ; Thu, 2 Oct 2025 12:56:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759409763; cv=none; b=InFat3TdaW4uBpYeq4IfDdR052W1SQFP2j1vCYNZJpNhMQQavFnj6GorLaCBiPh6O8keXEcq87BmAg8FHuE1PG4oQ73r/Be2Ulw8v26lowHKsZloftGRXjYl7q+01Sdx9d56EFxX7ckgTnZT498w3u561L5m7CVfwHkhyDtE2xw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759409763; c=relaxed/simple; bh=9r8D1Ia+7T65S7+gLRLQvq/94isctKWxfIk9igEoCMA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ik30sxgMpKO8kv6dCmuts15R1BD3TMPwXfZIYqc2EK6flHYFe4aE1TW4laeMHJGO3ofgkctzDt9iildJeUCwyP+L5p7DYB3DmKIKflBJYFF9tONZ67SxqTb0poAjkbWkrCi1Sp3HV6MmNiP1xsOiYs+Tlye/8LIXnK66/tGiQnI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Evqvnusg; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Evqvnusg" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-782bfd0a977so939099b3a.3 for ; Thu, 02 Oct 2025 05:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759409761; x=1760014561; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=liFJfORZ6KCp7kHXPgYfVbACM9rdKFMKa0FUPuD6JWs=; b=EvqvnusgR0nTPCF7ZmAGR8jYDvrQJ0Dw3Z+HXcocKpjadKXpnxiqv3qK5muKphC64e vYLcMY9M4hdANeRSUq157QVktE07yegqPg6DYAKFRGqcL7GNHLxFPHPDaIDPFUrD8+cG tMgYzKwaZHGPX1G8C3tuYqEBi03m9S5/kLe3kqE2As3WdR25wGWkQxUx4MGmq1naMjI6 hHYgVKb2OhtUITw3YueFZS7sGP89yWmFfE7pPz+FIREDhOyF+3i1nymUxF/Ed4mq0vab Xlq04osm5tbCzbtI8amLEjTgKgDKgMyjhJtfEDJopeJwqqtI65X1hVNbit5+6GZ07vV0 0srw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759409761; x=1760014561; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=liFJfORZ6KCp7kHXPgYfVbACM9rdKFMKa0FUPuD6JWs=; b=Gc1F51/MYHrXtDSviIC+L7xapxsj86CrlISHSVSSADvkXT3TqDNro+1UrNF8pV3Rw7 cdE1GPrN/fewetPThTTdBMtuN+v37KsjlRzMwGvPU5gvB7pTOvIKqcshTVz6vFy/I1ll UuWFrTm9bY6CbvMgoPLU37nNXBZkpAhZbQDrxy37TZxC95fN7ChXYc3LBRPSvlBJAqdv 0n2sk69KYSPeeL8GEwcZRKNdclK/F7ByuQnClZ1gatDA4MwJYhvVlc7IyM4H0xAcrWm6 apgC9WAZ5U3p53iIIQ32W+1rAJQbVxa9NukjYTmegRuYQye0GBxKVofqhFqRaAs7Xms5 RRkg== X-Forwarded-Encrypted: i=1; AJvYcCVRupj9XB+W3an+qyxXJEXySaoS3nY8R5ctPpTl99oZqgbowJfLdp690Ef4B7iivKYxsNY+Qv8P8dFGdRs=@vger.kernel.org X-Gm-Message-State: AOJu0YwNOI1AqBgUNilXaHmvTxIOqKe9vnaTI83nbYWFV1BSKbUA74dC PF9AgI4rnieSBbIg4/TFtfMG3I+yYAdtNvPJbzmNHFkrO/3iE6FFmbZg X-Gm-Gg: ASbGnctme9oR3hrsqVVwTfmIzT28D7Gb+axe5tzqRynAcyxO65REXeTdZ+5fCiBLauB 4NDCjWVmDwYCvhEusxxx9WOIEV4MtlLGEpwjddbzF9Br9eP/u8VGqBeOc8hr7LJvHE8HEfRfx2y 2BDUrvBDUcDgjy22bdu43pWnIbPoS7P3p555LuuWYqtep7MSCIlZspYpSuX4aHoU4I8h2fGJxks AZLXSZS8OAVxEkzigeJvKTKSeqLWLDk4ceyvkIj+iQfjJDsrRc+D4GosCrux5Aj/IpgioRF88xX aGc+uKiICqXM7sPMPpNb4K6iQRG0koxi0I9+HzK2qhjj0XDVR79PBtynHDZiTzQ71dTkzJyE61M 1vquVPZxi/vsqXIFCtoqm03urpsO+MOsBZUGmBaWlKbkwocU= X-Google-Smtp-Source: AGHT+IFxEVIjGgE2WbwvMRK3nIzpxLLtzOxwcwYUTWec+ETiVhQHUCufkeqn8RIupSVgwQPmrDcW+A== X-Received: by 2002:a05:6a00:2447:b0:77f:1ef8:8acb with SMTP id d2e1a72fcca58-78af4156ba3mr8365667b3a.13.1759409760877; Thu, 02 Oct 2025 05:56:00 -0700 (PDT) Received: from fedora ([2405:201:3017:a80:9e5c:2c74:b73f:890a]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-78b01f9a2b9sm2165556b3a.19.2025.10.02.05.55.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Oct 2025 05:56:00 -0700 (PDT) From: Bhavik Sachdev To: Alexander Viro , Christian Brauner Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Aleksa Sarai , Bhavik Sachdev , Pavel Tikhomirov , Jan Kara , John Garry , Arnaldo Carvalho de Melo , "Darrick J . Wong" , Namhyung Kim , Ingo Molnar , Andrei Vagin , Alexander Mikhalitsyn Subject: [PATCH 4/4] fs/stat: export mnt_ns_id through statx Date: Thu, 2 Oct 2025 18:18:40 +0530 Message-ID: <20251002125422.203598-5-b.sachdev1904@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251002125422.203598-1-b.sachdev1904@gmail.com> References: <20251002125422.203598-1-b.sachdev1904@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Currently, we have no good way to get mount info for the mount a given file descriptor is on. statx only provides it's mnt_id but we would have to call statmount with every single mnt_ns_id in order to get mount info since we have no way of knowing the mount namespace this mnt_id belongs to. This patch modifies statx to also export mnt_ns_id, allowing userspace to easily get mount info for the mount a file descriptor is on by using a combination of statx + statmount. ``` statx(fd, =E2=80=9C=E2=80=9D, AT_EMPTY_PATH, STATX_MNT_ID_UNIQUE | STATX_MNT_NS_ID, &stat); struct mnt_id_req req =3D { .mnt_id =3D stat.stx_mnt_id, .mnt_ns_id =3D stat.stx_mnt_ns_id }; statmount(&req, &statmount_buf, buf_size, 0); ``` Signed-off-by: Bhavik Sachdev --- fs/stat.c | 15 +++++++++++++-- include/linux/stat.h | 1 + include/uapi/linux/stat.h | 4 +++- tools/include/uapi/linux/stat.h | 4 +++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/fs/stat.c b/fs/stat.c index f95c1dc3eaa4..1cc29946c0c3 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -296,18 +296,28 @@ static int statx_lookup_flags(int flags) static int vfs_statx_path(struct path *path, int flags, struct kstat *stat, u32 request_mask) { + struct mount *real_mnt; int error =3D vfs_getattr(path, stat, request_mask, flags); if (error) return error; =20 + real_mnt =3D real_mount(path->mnt); + if (request_mask & STATX_MNT_ID_UNIQUE) { - stat->mnt_id =3D real_mount(path->mnt)->mnt_id_unique; + stat->mnt_id =3D real_mnt->mnt_id_unique; stat->result_mask |=3D STATX_MNT_ID_UNIQUE; } else { - stat->mnt_id =3D real_mount(path->mnt)->mnt_id; + stat->mnt_id =3D real_mnt->mnt_id; stat->result_mask |=3D STATX_MNT_ID; } =20 + if (request_mask & STATX_MNT_NS_ID) { + if (!real_mnt->mnt_ns) + /* returning EINVAL for now */ + return -EINVAL; + stat->mnt_ns_id =3D real_mnt->mnt_ns->seq; + } + if (path_mounted(path)) stat->attributes |=3D STATX_ATTR_MOUNT_ROOT; stat->attributes_mask |=3D STATX_ATTR_MOUNT_ROOT; @@ -745,6 +755,7 @@ cp_statx(const struct kstat *stat, struct statx __user = *buffer) tmp.stx_atomic_write_unit_max =3D stat->atomic_write_unit_max; tmp.stx_atomic_write_segments_max =3D stat->atomic_write_segments_max; tmp.stx_atomic_write_unit_max_opt =3D stat->atomic_write_unit_max_opt; + tmp.stx_mnt_ns_id =3D stat->mnt_ns_id; =20 return copy_to_user(buffer, &tmp, sizeof(tmp)) ? -EFAULT : 0; } diff --git a/include/linux/stat.h b/include/linux/stat.h index e3d00e7bb26d..c62b70ce30d9 100644 --- a/include/linux/stat.h +++ b/include/linux/stat.h @@ -59,6 +59,7 @@ struct kstat { u32 atomic_write_unit_max; u32 atomic_write_unit_max_opt; u32 atomic_write_segments_max; + u64 mnt_ns_id; }; =20 /* These definitions are internal to the kernel for now. Mainly used by nf= sd. */ diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h index 1686861aae20..1071f5097d26 100644 --- a/include/uapi/linux/stat.h +++ b/include/uapi/linux/stat.h @@ -187,7 +187,8 @@ struct statx { __u32 __spare2[1]; =20 /* 0xc0 */ - __u64 __spare3[8]; /* Spare space for future expansion */ + __u64 stx_mnt_ns_id; + __u64 __spare3[7]; /* Spare space for future expansion */ =20 /* 0x100 */ }; @@ -219,6 +220,7 @@ struct statx { #define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */ #define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */ #define STATX_DIO_READ_ALIGN 0x00020000U /* Want/got dio read alignment in= fo */ +#define STATX_MNT_NS_ID 0x00040000U /* Want/got stx_mnt_ns_id */ =20 #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx e= xpansion */ =20 diff --git a/tools/include/uapi/linux/stat.h b/tools/include/uapi/linux/sta= t.h index 1686861aae20..1071f5097d26 100644 --- a/tools/include/uapi/linux/stat.h +++ b/tools/include/uapi/linux/stat.h @@ -187,7 +187,8 @@ struct statx { __u32 __spare2[1]; =20 /* 0xc0 */ - __u64 __spare3[8]; /* Spare space for future expansion */ + __u64 stx_mnt_ns_id; + __u64 __spare3[7]; /* Spare space for future expansion */ =20 /* 0x100 */ }; @@ -219,6 +220,7 @@ struct statx { #define STATX_SUBVOL 0x00008000U /* Want/got stx_subvol */ #define STATX_WRITE_ATOMIC 0x00010000U /* Want/got atomic_write_* fields */ #define STATX_DIO_READ_ALIGN 0x00020000U /* Want/got dio read alignment in= fo */ +#define STATX_MNT_NS_ID 0x00040000U /* Want/got stx_mnt_ns_id */ =20 #define STATX__RESERVED 0x80000000U /* Reserved for future struct statx e= xpansion */ =20 --=20 2.51.0