On Mon, Oct 03, 2016 at 12:16:49PM +0200, Martin Natano wrote:
> > /*
> >  * Flags set by internal operations.
> >  */
> > #define MNT_LOCAL       0x00001000      /* filesystem is stored locally */
> > #define MNT_QUOTA       0x00002000      /* quotas are enabled on filesystem 
> > */
> > #define MNT_ROOTFS      0x00004000      /* identifies the root filesystem */
> 
> Yes, done. I also removed MNT_DOOMED and MNT_WANTRDWR from the flag
> mask, as those flags are internal to the kernel and shouldn't be passed
> from userland.

I have just checked the mountd/mountd.c code.  It does a statfs(path,
&sfb) and then mount(sfb.f_fstypename, sfb.f_mntonname, sfb.f_flags
| MNT_UPDATE, &args).

So all flags that are set by the kernel can be passed back.  But
the kernel ignores some flags.  The current diff breaks that
semantics.

The optnames in sbin/mount/mount.c contains a good list of flags
that sould be ignored.  The o_optname column is "".

I still want the list of valid flags at the beginning of the system
call and not hidden in all the file system specific implementations.

So perhaps we can combine the your orignal diff with all flags and
the clearing the internal flags like it is done in sys_unmount.

If the bits are not defined anywhere, return EINVAL.  Then clear
all bits that should not be set by mount or unmount system call.

> Now, that MNT_FLAGMASK doesn't contain all flags anymore, I replaced the
> magic constant with the flag names to make it clearer which flags are
> included.

I am not sure wether we should define MNT_FLAGMASK in the header
or only in the system call implementation.

> +#define MNT_FLAGMASK (MNT_RDONLY|MNT_SYNCHRONOUS|MNT_NOEXEC|MNT_NOSUID|\
> +                      MNT_NODEV|MNT_NOPERM|MNT_ASYNC|MNT_WXALLOWED|\
> +                      MNT_EXRDONLY|MNT_EXPORTED|MNT_DEFEXPORTED|\
> +                      MNT_EXPORTANON|MNT_NOATIME|MNT_UPDATE|MNT_DELEXPORT|\
> +                      MNT_RELOAD|MNT_FORCE|MNT_SOFTDEP)

I think the nfs export flags can only be set in the ufs_args
export_info.ex_flags field.

bluhm

Reply via email to