[12/12] vfs: don't parse "silent" option
diff mbox series

Message ID 20191128155940.17530-13-mszeredi@redhat.com
State New
Headers show
Series
  • various vfs patches
Related show

Commit Message

Miklos Szeredi Nov. 28, 2019, 3:59 p.m. UTC
While this is a standard option as documented in mount(8), it is ignored by
most filesystems.  So reject, unless filesystem explicitly wants to handle
it.

The exception is unconverted filesystems, where it is unknown if the
filesystem handles this or not.

Any implementation, such as mount(8), that needs to parse this option
without failing can simply ignore the return value from fsconfig().

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
---
 fs/fs_context.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Al Viro Dec. 17, 2019, 3:37 a.m. UTC | #1
On Thu, Nov 28, 2019 at 04:59:40PM +0100, Miklos Szeredi wrote:
> While this is a standard option as documented in mount(8), it is ignored by
> most filesystems.  So reject, unless filesystem explicitly wants to handle
> it.
>
> The exception is unconverted filesystems, where it is unknown if the
> filesystem handles this or not.
> 
> Any implementation, such as mount(8), that needs to parse this option
> without failing can simply ignore the return value from fsconfig().

Unless I'm missing something, that will mean that having it in /etc/fstab
for a converted filesystem (xfs, for example) will fail when booting
new kernel with existing /sbin/mount.  Doesn't sound like a good idea...
Miklos Szeredi Dec. 17, 2019, 4:12 a.m. UTC | #2
On Tue, Dec 17, 2019 at 4:37 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> On Thu, Nov 28, 2019 at 04:59:40PM +0100, Miklos Szeredi wrote:
> > While this is a standard option as documented in mount(8), it is ignored by
> > most filesystems.  So reject, unless filesystem explicitly wants to handle
> > it.
> >
> > The exception is unconverted filesystems, where it is unknown if the
> > filesystem handles this or not.
> >
> > Any implementation, such as mount(8), that needs to parse this option
> > without failing can simply ignore the return value from fsconfig().
>
> Unless I'm missing something, that will mean that having it in /etc/fstab
> for a converted filesystem (xfs, for example) will fail when booting
> new kernel with existing /sbin/mount.  Doesn't sound like a good idea...

Nope, the mount(2) case is not changed (see second hunk).

When mount(8) is converted to the new API, it can just handle such
back compat issues (ignore error from fconfig()) in that case.

Thanks,
Miklos
Miklos Szeredi Dec. 17, 2019, 4:16 a.m. UTC | #3
On Tue, Dec 17, 2019 at 5:12 AM Miklos Szeredi <miklos@szeredi.hu> wrote:
>
> On Tue, Dec 17, 2019 at 4:37 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
> >
> > On Thu, Nov 28, 2019 at 04:59:40PM +0100, Miklos Szeredi wrote:
> > > While this is a standard option as documented in mount(8), it is ignored by
> > > most filesystems.  So reject, unless filesystem explicitly wants to handle
> > > it.
> > >
> > > The exception is unconverted filesystems, where it is unknown if the
> > > filesystem handles this or not.
> > >
> > > Any implementation, such as mount(8), that needs to parse this option
> > > without failing can simply ignore the return value from fsconfig().
> >
> > Unless I'm missing something, that will mean that having it in /etc/fstab
> > for a converted filesystem (xfs, for example) will fail when booting
> > new kernel with existing /sbin/mount.  Doesn't sound like a good idea...
>
> Nope, the mount(2) case is not changed (see second hunk).

Wrong, this has nothing to do with mount(2).  The second hunk is about
unconverted filesystems...

When a filesystem that really needs to handle "silent" is converted,
it can handle that option itself.

Thanks,
Miklos
Al Viro Dec. 17, 2019, 4:17 a.m. UTC | #4
On Tue, Dec 17, 2019 at 05:12:05AM +0100, Miklos Szeredi wrote:
> On Tue, Dec 17, 2019 at 4:37 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
> >
> > On Thu, Nov 28, 2019 at 04:59:40PM +0100, Miklos Szeredi wrote:
> > > While this is a standard option as documented in mount(8), it is ignored by
> > > most filesystems.  So reject, unless filesystem explicitly wants to handle
> > > it.
> > >
> > > The exception is unconverted filesystems, where it is unknown if the
> > > filesystem handles this or not.
> > >
> > > Any implementation, such as mount(8), that needs to parse this option
> > > without failing can simply ignore the return value from fsconfig().
> >
> > Unless I'm missing something, that will mean that having it in /etc/fstab
> > for a converted filesystem (xfs, for example) will fail when booting
> > new kernel with existing /sbin/mount.  Doesn't sound like a good idea...
> 
> Nope, the mount(2) case is not changed (see second hunk).

How would mounting XFS end up calling legacy_parse_param(), rather than
the expected generic_parse_monolithic() -> vfs_parse_fs_string() ->
vfs_parse_fs_param() -> xfs_fc_parse_param()?
Al Viro Dec. 17, 2019, 4:19 a.m. UTC | #5
On Tue, Dec 17, 2019 at 05:16:58AM +0100, Miklos Szeredi wrote:
> On Tue, Dec 17, 2019 at 5:12 AM Miklos Szeredi <miklos@szeredi.hu> wrote:
> >
> > On Tue, Dec 17, 2019 at 4:37 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
> > >
> > > On Thu, Nov 28, 2019 at 04:59:40PM +0100, Miklos Szeredi wrote:
> > > > While this is a standard option as documented in mount(8), it is ignored by
> > > > most filesystems.  So reject, unless filesystem explicitly wants to handle
> > > > it.
> > > >
> > > > The exception is unconverted filesystems, where it is unknown if the
> > > > filesystem handles this or not.
> > > >
> > > > Any implementation, such as mount(8), that needs to parse this option
> > > > without failing can simply ignore the return value from fsconfig().
> > >
> > > Unless I'm missing something, that will mean that having it in /etc/fstab
> > > for a converted filesystem (xfs, for example) will fail when booting
> > > new kernel with existing /sbin/mount.  Doesn't sound like a good idea...
> >
> > Nope, the mount(2) case is not changed (see second hunk).
> 
> Wrong, this has nothing to do with mount(2).  The second hunk is about
> unconverted filesystems...
> 
> When a filesystem that really needs to handle "silent" is converted,
> it can handle that option itself.

You know, I had a specific reason to mention XFS...
Miklos Szeredi Dec. 17, 2019, 4:23 a.m. UTC | #6
On Tue, Dec 17, 2019 at 5:19 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> On Tue, Dec 17, 2019 at 05:16:58AM +0100, Miklos Szeredi wrote:
> > On Tue, Dec 17, 2019 at 5:12 AM Miklos Szeredi <miklos@szeredi.hu> wrote:
> > >
> > > On Tue, Dec 17, 2019 at 4:37 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
> > > >
> > > > On Thu, Nov 28, 2019 at 04:59:40PM +0100, Miklos Szeredi wrote:
> > > > > While this is a standard option as documented in mount(8), it is ignored by
> > > > > most filesystems.  So reject, unless filesystem explicitly wants to handle
> > > > > it.
> > > > >
> > > > > The exception is unconverted filesystems, where it is unknown if the
> > > > > filesystem handles this or not.
> > > > >
> > > > > Any implementation, such as mount(8), that needs to parse this option
> > > > > without failing can simply ignore the return value from fsconfig().
> > > >
> > > > Unless I'm missing something, that will mean that having it in /etc/fstab
> > > > for a converted filesystem (xfs, for example) will fail when booting
> > > > new kernel with existing /sbin/mount.  Doesn't sound like a good idea...
> > >
> > > Nope, the mount(2) case is not changed (see second hunk).
> >
> > Wrong, this has nothing to do with mount(2).  The second hunk is about
> > unconverted filesystems...
> >
> > When a filesystem that really needs to handle "silent" is converted,
> > it can handle that option itself.
>
> You know, I had a specific reason to mention XFS...

Will fix.  My bad, I did check filesystems at the time of writing the
patch, but not when resending...

Thanks,
Miklos
Miklos Szeredi Dec. 17, 2019, 4:28 a.m. UTC | #7
On Tue, Dec 17, 2019 at 5:23 AM Miklos Szeredi <miklos@szeredi.hu> wrote:
>
> On Tue, Dec 17, 2019 at 5:19 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
> >
> > On Tue, Dec 17, 2019 at 05:16:58AM +0100, Miklos Szeredi wrote:
> > > On Tue, Dec 17, 2019 at 5:12 AM Miklos Szeredi <miklos@szeredi.hu> wrote:
> > > >
> > > > On Tue, Dec 17, 2019 at 4:37 AM Al Viro <viro@zeniv.linux.org.uk> wrote:
> > > > >
> > > > > On Thu, Nov 28, 2019 at 04:59:40PM +0100, Miklos Szeredi wrote:
> > > > > > While this is a standard option as documented in mount(8), it is ignored by
> > > > > > most filesystems.  So reject, unless filesystem explicitly wants to handle
> > > > > > it.
> > > > > >
> > > > > > The exception is unconverted filesystems, where it is unknown if the
> > > > > > filesystem handles this or not.
> > > > > >
> > > > > > Any implementation, such as mount(8), that needs to parse this option
> > > > > > without failing can simply ignore the return value from fsconfig().
> > > > >
> > > > > Unless I'm missing something, that will mean that having it in /etc/fstab
> > > > > for a converted filesystem (xfs, for example) will fail when booting
> > > > > new kernel with existing /sbin/mount.  Doesn't sound like a good idea...
> > > >
> > > > Nope, the mount(2) case is not changed (see second hunk).
> > >
> > > Wrong, this has nothing to do with mount(2).  The second hunk is about
> > > unconverted filesystems...
> > >
> > > When a filesystem that really needs to handle "silent" is converted,
> > > it can handle that option itself.
> >
> > You know, I had a specific reason to mention XFS...
>
> Will fix.  My bad, I did check filesystems at the time of writing the
> patch, but not when resending...

And BTW this is still not breakage of mount(2) since that code path is
unaffected.  Would need to think  how much the "silent" option makes
sense on the new interface for individual cases specifically.

Thanks,
Miklos

Patch
diff mbox series

diff --git a/fs/fs_context.c b/fs/fs_context.c
index 738f59b6c06a..b37ce07ee230 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -51,7 +51,6 @@  static const struct constant_table common_clear_sb_flag[] = {
 	{ "nolazytime",	SB_LAZYTIME },
 	{ "nomand",	SB_MANDLOCK },
 	{ "rw",		SB_RDONLY },
-	{ "silent",	SB_SILENT },
 };
 
 /*
@@ -530,6 +529,15 @@  static int legacy_parse_param(struct fs_context *fc, struct fs_parameter *param)
 	unsigned int size = ctx->data_size;
 	size_t len = 0;
 
+	if (strcmp(param->key, "silent") == 0) {
+		if (param->type != fs_value_is_flag)
+			return invalf(fc, "%s: Unexpected value for '%s'",
+				      fc->fs_type->name, param->key);
+
+		fc->sb_flags |= SB_SILENT;
+		return 0;
+	}
+
 	if (strcmp(param->key, "source") == 0) {
 		if (param->type != fs_value_is_string)
 			return invalf(fc, "VFS: Legacy: Non-string source");