Re: [EXPERIMENT] new mount API verbose errors from userspace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 2, 2021 at 5:03 AM Aurélien Aptel <aaptel@xxxxxxxx> wrote:
>
> Hi,
>
> I have some code to use the new mount API from user space.
>
> The kernel changes are just making the code use the fs_context logging
> feature.
>
> The sample userspace prog (fsopen.c) is just a PoC showing how mounting
> is done and how the mount errors are read.
>
> If you change the prog to use a wrong version for example (vers=4.0) you
> get this:
>
>     $ gcc -o fsopen fsopen.c
>     $ ./fsopen
>     fsconfig(sfd, FSCONFIG_SET_STRING, "vers", "4.0", 0): Invalid argument
>     kernel mount errors:
>     e Unknown vers= option specified: 4.0
>
> There are some cons to using this API, mainly that mount.cifs will have
> to encode more knowledge and processing of the user-provided option
> before passing it to the kernel.
>
> Where previously we would pass most options as-is to the kernel, making
> it easier to add new ones without patching mount.cifs; we know have to
> know if the option is a key=string, or key=int, or boolean (key/nokey)
> and call the appropriate FSCONFIG_SET_{STRING,FLAG,PATH,...}.
>
> The pros are that we process one option at a time and we can fail early
> with verbose, helpful messages to the user.

I like this, this is very nice.
But, as you touch upon, it requires we know in mount.c what type each
argument is.
Which is problematic because the list of mount arguments in cifs.ko
has a fair amount of crunch
and I think it would be unworkable to keep cifs-utils and cifs.ko in
lockstep for every release where
we modify a mount argument.

What I think we should have is a ioctl(),  system-call,
/proc/fs/cifs/options,  where we can query the kernel/file-system
module
for "give me a list of all recognized mount options and their type"
i.e. basically a way to fetch the "struct fs_parameter_spec" to userspace.

This is probably something that would not be specific to cifs, but
would apply to all filesystem modules.


regards
ronnie sahlberg


>
>
> Cheers,
> --
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux