From: "J. Bruce Fields" <bfields@fieldses.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Lennart Poettering <mzxreary@0pointer.de>,
Ian Kent <raven@themaw.net>, David Howells <dhowells@redhat.com>,
Christian Brauner <christian.brauner@ubuntu.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>,
dray@redhat.com, Karel Zak <kzak@redhat.com>,
Miklos Szeredi <mszeredi@redhat.com>,
Steven Whitehouse <swhiteho@redhat.com>,
Jeff Layton <jlayton@redhat.com>,
andres@anarazel.de, keyrings@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Aleksa Sarai <cyphar@cyphar.com>
Subject: Re: Upcoming: Notifications, FS notifications and fsinfo()
Date: Mon, 06 Apr 2020 16:07:06 +0000 [thread overview]
Message-ID: <20200406160706.GC2147@fieldses.org> (raw)
In-Reply-To: <CAJfpegvxnp8N-o-iTXzj0UnYZbDPfms1zpwcHf1tdhRJ4au3Og@mail.gmail.com>
The patch makes sense to me, thanks!
In the NFS case it's implementing the "mountpoint" export option:
mountpoint=path
mp This option makes it possible to only export a directory if it
has successfully been mounted. If no path is given (e.g.
mountpoint or mp) then the export point must also be a mount
point. If it isn't then the export point is not exported. This
allows you to be sure that the directory underneath a mountpoint
will never be exported by accident if, for example, the filesysâ
tem failed to mount due to a disc error.
If a path is given (e.g. mountpoint=/path or mp=/path) then the
nominated path must be a mountpoint for the exportpoint to be
exported.
--b.
On Mon, Apr 06, 2020 at 10:35:55AM +0200, Miklos Szeredi wrote:
> From: Miklos Szeredi <mszeredi@redhat.com>
> Subject: statx: add mount_root
>
> Determining whether a path or file descriptor refers to a mountpoint (or
> more precisely a mount root) is not trivial using current tools.
>
> Add a flag to statx that indicates whether the path or fd refers to the
> root of a mount or not.
>
> Reported-by: Lennart Poettering <mzxreary@0pointer.de>
> Reported-by: J. Bruce Fields <bfields@fieldses.org>
> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
> ---
> fs/stat.c | 3 +++
> include/uapi/linux/stat.h | 1 +
> 2 files changed, 4 insertions(+)
>
> --- a/include/uapi/linux/stat.h
> +++ b/include/uapi/linux/stat.h
> @@ -172,6 +172,7 @@ struct statx {
> #define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */
> #define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */
> #define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */
> +#define STATX_ATTR_MOUNT_ROOT 0x00002000 /* Root of a mount */
> #define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */
>
>
> --- a/fs/stat.c
> +++ b/fs/stat.c
> @@ -202,6 +202,9 @@ int vfs_statx(int dfd, const char __user
> error = vfs_getattr(&path, stat, request_mask, flags);
> stat->mnt_id = real_mount(path.mnt)->mnt_id;
> stat->result_mask |= STATX_MNT_ID;
> + if (path.mnt->mnt_root = path.dentry)
> + stat->attributes |= STATX_ATTR_MOUNT_ROOT;
> + stat->attributes_mask |= STATX_ATTR_MOUNT_ROOT;
> path_put(&path);
> if (retry_estale(error, lookup_flags)) {
> lookup_flags |= LOOKUP_REVAL;
WARNING: multiple messages have this Message-ID (diff)
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Lennart Poettering <mzxreary@0pointer.de>,
Ian Kent <raven@themaw.net>, David Howells <dhowells@redhat.com>,
Christian Brauner <christian.brauner@ubuntu.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>,
dray@redhat.com, Karel Zak <kzak@redhat.com>,
Miklos Szeredi <mszeredi@redhat.com>,
Steven Whitehouse <swhiteho@redhat.com>,
Jeff Layton <jlayton@redhat.com>,
andres@anarazel.de, keyrings@vger.kernel.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Aleksa Sarai <cyphar@cyphar.com>
Subject: Re: Upcoming: Notifications, FS notifications and fsinfo()
Date: Mon, 6 Apr 2020 12:07:06 -0400 [thread overview]
Message-ID: <20200406160706.GC2147@fieldses.org> (raw)
In-Reply-To: <CAJfpegvxnp8N-o-iTXzj0UnYZbDPfms1zpwcHf1tdhRJ4au3Og@mail.gmail.com>
The patch makes sense to me, thanks!
In the NFS case it's implementing the "mountpoint" export option:
mountpoint=path
mp This option makes it possible to only export a directory if it
has successfully been mounted. If no path is given (e.g.
mountpoint or mp) then the export point must also be a mount
point. If it isn't then the export point is not exported. This
allows you to be sure that the directory underneath a mountpoint
will never be exported by accident if, for example, the filesys‐
tem failed to mount due to a disc error.
If a path is given (e.g. mountpoint=/path or mp=/path) then the
nominated path must be a mountpoint for the exportpoint to be
exported.
--b.
On Mon, Apr 06, 2020 at 10:35:55AM +0200, Miklos Szeredi wrote:
> From: Miklos Szeredi <mszeredi@redhat.com>
> Subject: statx: add mount_root
>
> Determining whether a path or file descriptor refers to a mountpoint (or
> more precisely a mount root) is not trivial using current tools.
>
> Add a flag to statx that indicates whether the path or fd refers to the
> root of a mount or not.
>
> Reported-by: Lennart Poettering <mzxreary@0pointer.de>
> Reported-by: J. Bruce Fields <bfields@fieldses.org>
> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
> ---
> fs/stat.c | 3 +++
> include/uapi/linux/stat.h | 1 +
> 2 files changed, 4 insertions(+)
>
> --- a/include/uapi/linux/stat.h
> +++ b/include/uapi/linux/stat.h
> @@ -172,6 +172,7 @@ struct statx {
> #define STATX_ATTR_NODUMP 0x00000040 /* [I] File is not to be dumped */
> #define STATX_ATTR_ENCRYPTED 0x00000800 /* [I] File requires key to decrypt in fs */
> #define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */
> +#define STATX_ATTR_MOUNT_ROOT 0x00002000 /* Root of a mount */
> #define STATX_ATTR_VERITY 0x00100000 /* [I] Verity protected file */
>
>
> --- a/fs/stat.c
> +++ b/fs/stat.c
> @@ -202,6 +202,9 @@ int vfs_statx(int dfd, const char __user
> error = vfs_getattr(&path, stat, request_mask, flags);
> stat->mnt_id = real_mount(path.mnt)->mnt_id;
> stat->result_mask |= STATX_MNT_ID;
> + if (path.mnt->mnt_root == path.dentry)
> + stat->attributes |= STATX_ATTR_MOUNT_ROOT;
> + stat->attributes_mask |= STATX_ATTR_MOUNT_ROOT;
> path_put(&path);
> if (retry_estale(error, lookup_flags)) {
> lookup_flags |= LOOKUP_REVAL;
next prev parent reply other threads:[~2020-04-06 16:07 UTC|newest]
Thread overview: 199+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 13:58 Upcoming: Notifications, FS notifications and fsinfo() David Howells
2020-03-30 13:58 ` David Howells
2020-03-30 14:31 ` [GIT PULL] General notification queue and key notifications David Howells
2020-03-30 14:31 ` David Howells
2020-03-31 6:51 ` Stephen Rothwell
2020-03-31 6:51 ` Stephen Rothwell
2020-06-02 15:55 ` David Howells
2020-06-02 15:55 ` David Howells
2020-06-03 2:15 ` Ian Kent
2020-06-03 2:15 ` Ian Kent
2020-06-08 0:49 ` Ian Kent
2020-06-08 0:49 ` Ian Kent
2020-06-10 9:56 ` Christian Brauner
2020-06-10 9:56 ` Christian Brauner
2020-06-10 11:12 ` Karel Zak
2020-06-10 11:12 ` Karel Zak
2020-06-12 21:32 ` Linus Torvalds
2020-06-12 21:32 ` Linus Torvalds
2020-06-13 13:04 ` David Howells
2020-06-13 13:04 ` David Howells
2020-06-13 16:47 ` Linus Torvalds
2020-06-13 16:47 ` Linus Torvalds
2020-06-13 17:03 ` Linus Torvalds
2020-06-13 17:03 ` Linus Torvalds
2020-06-13 19:22 ` Miklos Szeredi
2020-06-13 19:22 ` Miklos Szeredi
2020-06-12 22:01 ` Linus Torvalds
2020-06-12 22:01 ` Linus Torvalds
2020-06-13 13:24 ` David Howells
2020-06-13 13:24 ` David Howells
2020-06-13 18:00 ` pr-tracker-bot
2020-06-13 18:00 ` pr-tracker-bot
2020-06-17 1:15 ` Williams, Dan J
2020-06-17 1:15 ` Williams, Dan J
2020-06-17 1:15 ` Williams, Dan J
2020-06-23 23:38 ` Dan Williams
2020-06-23 23:38 ` Dan Williams
2020-06-23 23:38 ` Dan Williams
2020-06-24 0:55 ` David Howells
2020-06-24 0:55 ` David Howells
2020-06-24 0:55 ` David Howells
2020-06-24 1:03 ` Dan Williams
2020-06-24 1:03 ` Dan Williams
2020-06-24 1:03 ` Dan Williams
2020-06-24 1:17 ` David Howells
2020-06-24 1:17 ` David Howells
2020-06-24 1:17 ` David Howells
2020-03-30 14:36 ` [GIT PULL] Mount and superblock notifications David Howells
2020-03-30 14:36 ` David Howells
2020-04-04 21:13 ` Linus Torvalds
2020-04-04 21:13 ` Linus Torvalds
2020-04-05 22:52 ` Andres Freund
2020-04-05 22:52 ` Andres Freund
2020-03-30 14:43 ` [GIT PULL] fsinfo: Filesystem information query David Howells
2020-03-30 14:43 ` David Howells
2020-03-30 20:28 ` Upcoming: Notifications, FS notifications and fsinfo() Miklos Szeredi
2020-03-30 20:28 ` Miklos Szeredi
2020-03-31 9:21 ` Karel Zak
2020-03-31 9:21 ` Karel Zak
2020-03-31 17:31 ` David Howells
2020-03-31 17:31 ` David Howells
2020-03-31 19:42 ` Miklos Szeredi
2020-03-31 19:42 ` Miklos Szeredi
2020-03-31 19:47 ` David Howells
2020-03-31 19:47 ` David Howells
2020-03-31 21:14 ` David Howells
2020-03-31 21:14 ` David Howells
2020-03-31 21:23 ` David Howells
2020-03-31 21:23 ` David Howells
2020-03-30 21:17 ` Christian Brauner
2020-03-30 21:17 ` Christian Brauner
2020-03-31 5:11 ` Miklos Szeredi
2020-03-31 5:11 ` Miklos Szeredi
2020-03-31 8:15 ` Christian Brauner
2020-03-31 8:15 ` Christian Brauner
2020-03-31 8:34 ` Miklos Szeredi
2020-03-31 8:34 ` Miklos Szeredi
2020-03-31 8:34 ` Karel Zak
2020-03-31 8:34 ` Karel Zak
2020-03-31 8:56 ` Miklos Szeredi
2020-03-31 8:56 ` Miklos Szeredi
2020-03-31 9:49 ` Karel Zak
2020-03-31 9:49 ` Karel Zak
2020-03-31 12:25 ` Lennart Poettering
2020-03-31 12:25 ` Lennart Poettering
2020-03-31 15:10 ` Miklos Szeredi
2020-03-31 15:10 ` Miklos Szeredi
2020-03-31 15:24 ` Lennart Poettering
2020-03-31 15:24 ` Lennart Poettering
2020-03-31 21:56 ` David Howells
2020-03-31 21:56 ` David Howells
2020-03-31 21:54 ` David Howells
2020-03-31 21:54 ` David Howells
2020-04-01 8:43 ` Karel Zak
2020-04-01 8:43 ` Karel Zak
2020-03-31 7:22 ` Lennart Poettering
2020-03-31 7:22 ` Lennart Poettering
2020-03-31 21:52 ` David Howells
2020-03-31 21:52 ` David Howells
2020-04-01 9:04 ` Karel Zak
2020-04-01 9:04 ` Karel Zak
2020-04-01 13:34 ` Miklos Szeredi
2020-04-01 13:34 ` Miklos Szeredi
2020-04-01 13:55 ` David Howells
2020-04-01 13:55 ` David Howells
2020-04-01 13:58 ` David Howells
2020-04-01 13:58 ` David Howells
2020-04-01 15:25 ` Miklos Szeredi
2020-04-01 15:25 ` Miklos Szeredi
2020-04-01 16:01 ` David Howells
2020-04-01 16:01 ` David Howells
2020-04-01 16:30 ` Miklos Szeredi
2020-04-01 16:30 ` Miklos Szeredi
2020-04-02 15:22 ` David Howells
2020-04-02 15:22 ` David Howells
2020-04-02 15:24 ` David Howells
2020-04-02 15:24 ` David Howells
2020-04-02 15:24 ` Miklos Szeredi
2020-04-02 15:24 ` Miklos Szeredi
2020-04-02 15:42 ` David Howells
2020-04-02 15:42 ` David Howells
2020-04-03 9:11 ` Karel Zak
2020-04-03 9:11 ` Karel Zak
2020-04-01 14:41 ` Lennart Poettering
2020-04-01 14:41 ` Lennart Poettering
2020-04-01 15:33 ` Miklos Szeredi
2020-04-01 15:33 ` Miklos Szeredi
2020-04-01 16:06 ` David Howells
2020-04-01 16:06 ` David Howells
2020-04-01 16:40 ` Miklos Szeredi
2020-04-01 16:40 ` Miklos Szeredi
2020-04-02 2:52 ` Ian Kent
2020-04-02 2:52 ` Ian Kent
2020-04-02 13:52 ` Miklos Szeredi
2020-04-02 13:52 ` Miklos Szeredi
2020-04-02 14:36 ` Lennart Poettering
2020-04-02 14:36 ` Lennart Poettering
2020-04-02 15:22 ` Miklos Szeredi
2020-04-02 15:22 ` Miklos Szeredi
2020-04-02 15:28 ` Lennart Poettering
2020-04-02 15:28 ` Lennart Poettering
2020-04-02 15:35 ` Miklos Szeredi
2020-04-02 15:35 ` Miklos Szeredi
2020-04-02 15:50 ` Lennart Poettering
2020-04-02 15:50 ` Lennart Poettering
2020-04-02 17:20 ` Miklos Szeredi
2020-04-02 17:20 ` Miklos Szeredi
2020-04-03 11:08 ` Lennart Poettering
2020-04-03 11:08 ` Lennart Poettering
2020-04-03 11:48 ` Miklos Szeredi
2020-04-03 11:48 ` Miklos Szeredi
2020-04-03 15:01 ` Lennart Poettering
2020-04-03 15:01 ` Lennart Poettering
2020-04-06 9:22 ` Miklos Szeredi
2020-04-06 9:22 ` Miklos Szeredi
2020-04-06 17:29 ` Lennart Poettering
2020-04-06 17:29 ` Lennart Poettering
2020-04-07 2:21 ` Ian Kent
2020-04-07 2:21 ` Ian Kent
2020-04-07 13:59 ` Miklos Szeredi
2020-04-07 13:59 ` Miklos Szeredi
2020-04-07 15:53 ` Lennart Poettering
2020-04-07 15:53 ` Lennart Poettering
2020-04-07 16:06 ` Miklos Szeredi
2020-04-07 16:06 ` Miklos Szeredi
2020-04-02 15:51 ` David Howells
2020-04-02 15:51 ` David Howells
2020-04-02 15:56 ` David Howells
2020-04-02 15:56 ` David Howells
2020-04-03 1:44 ` Ian Kent
2020-04-03 1:44 ` Ian Kent
2020-04-03 11:11 ` Lennart Poettering
2020-04-03 11:11 ` Lennart Poettering
2020-04-03 11:38 ` Miklos Szeredi
2020-04-03 11:38 ` Miklos Szeredi
2020-04-03 12:05 ` Richard Weinberger
2020-04-03 12:05 ` Richard Weinberger
2020-04-03 15:12 ` Lennart Poettering
2020-04-03 15:12 ` Lennart Poettering
2020-04-03 15:36 ` David Howells
2020-04-03 15:36 ` David Howells
2020-04-03 15:41 ` Lennart Poettering
2020-04-03 15:41 ` Lennart Poettering
2020-04-03 20:30 ` J. Bruce Fields
2020-04-03 20:30 ` J. Bruce Fields
2020-04-06 8:35 ` Miklos Szeredi
2020-04-06 8:35 ` Miklos Szeredi
2020-04-06 16:07 ` J. Bruce Fields [this message]
2020-04-06 16:07 ` J. Bruce Fields
2020-04-06 9:17 ` Karel Zak
2020-04-06 9:17 ` Karel Zak
2020-04-06 16:34 ` Linus Torvalds
2020-04-06 16:34 ` Linus Torvalds
2020-04-06 18:46 ` J. Bruce Fields
2020-04-06 18:46 ` J. Bruce Fields
2020-04-06 18:48 ` Lennart Poettering
2020-04-06 18:48 ` Lennart Poettering
2020-04-08 3:36 ` Linus Torvalds
2020-04-08 3:36 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200406160706.GC2147@fieldses.org \
--to=bfields@fieldses.org \
--cc=andres@anarazel.de \
--cc=christian.brauner@ubuntu.com \
--cc=cyphar@cyphar.com \
--cc=dhowells@redhat.com \
--cc=dray@redhat.com \
--cc=jlayton@redhat.com \
--cc=keyrings@vger.kernel.org \
--cc=kzak@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=mszeredi@redhat.com \
--cc=mzxreary@0pointer.de \
--cc=raven@themaw.net \
--cc=swhiteho@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.