[Devel] [PATCH RH7] mnt: allow to add a mount into an existing group

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri May 8 10:21:02 MSK 2020



On 5/7/20 9:38 PM, Konstantin Khorenko wrote:
> On 05/06/2020 02:59 PM, Pavel Tikhomirov wrote:
>> diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
>> index a4ca54304220..45e2752a85c9 100644
>> --- a/include/uapi/linux/fs.h
>> +++ b/include/uapi/linux/fs.h
>> @@ -99,6 +99,12 @@ struct inodes_stat_t {
>>  #define MS_STRICTATIME    (1<<24) /* Always perform atime updates */
>>  #define MS_LAZYTIME    (1<<25) /* Update the on-disk [acm]times 
>> lazily */
>>
>> +/*
>> + * Here are commands and flags. Commands are handled in do_mount()
>> + * and can intersect with kernel internal flags.
>> + */
>> +#define MS_SET_GROUP    (1<<26) /* Add a mount into a shared group */
>> +
>>  /* These sb flags are internal to the kernel */
>>  #define MS_SUBMOUNT     (1<<26)
> 
> Is it OK to have the flag's semantics overloaded?

1) do_mount is only called from syscall:

sys_osf_mount
   osf_ufs_mount
   osf_procfs_mount
   osf_cdfs_mount
     do_mount

compat_sys_mount
   do_mount

sys_mount
   do_mount

2) previousely MS_SUBMOUNT was explicitly ignored in vz7 in do_mount 
because it is kernel internal flag:

flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_BORN |
   MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
   MS_STRICTATIME | MS_NOREMOTELOCK | MS_SUBMOUNT);

in ms and vz8 it is a bit more complex but still ignored. Because it is 
kernel internal flag and userspace can't set it.

If we add MS_SET_GROUP with same number as MS_SUBMOUNT but only check it 
in do_mount where it was previousely ignored it looks OK to me.

> 
>>  #define MS_NOREMOTELOCK    (1<<27)

-- 
Best regards, Tikhomirov Pavel
Software Developer, Virtuozzo.


More information about the Devel mailing list