[CRIU] [PATCH 1/1] do_new_mount() should clear all do_change_type() bits

Pavel Emelyanov xemul at parallels.com
Tue Apr 14 10:24:48 PDT 2015


On 04/14/2015 08:15 PM, Oleg Nesterov wrote:
> Pavel, did you miss this patch?

No, I didn't :)

> I agree with Tycho, we need to do something with restore_shared_options()
> too. But afaics this needs another patch. In particular, It _seems__ to
> me we should move these restore_shared_options() callsites into a single
> callsite in do_mount_one().

Yes, but as Tycho is actively involved in the mount.c development, I
was waiting for his explicit ACK or NACK. So far this thread to me
looks as being under discussion. Is it?

-- Pavel

> On 04/13, Oleg Nesterov wrote:
>>
>> do_new_mount() clears MS_SHARED but this is not enough. It should clear
>> all bits processed in restore_shared_options().
>>
>> The patch also adds MS_UNBINDABLE to MS_CHANGE_TYPE_MASK even if it is
>> not currently used. Just to match the kernel's do_change_type() check.
>>
>> Signed-off-by: Oleg Nesterov <oleg at redhat.com>
>> ---
>>  mount.c |    5 ++++-
>>  1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/mount.c b/mount.c
>> index 8b57729..55d5f8b 100644
>> --- a/mount.c
>> +++ b/mount.c
>> @@ -1750,6 +1750,9 @@ skip_parent:
>>  	return 0;
>>  }
>>  
>> +#define MS_CHANGE_TYPE_MASK	\
>> +	(MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE)
>> +
>>  static int do_new_mount(struct mount_info *mi)
>>  {
>>  	char *src;
>> @@ -1760,7 +1763,7 @@ static int do_new_mount(struct mount_info *mi)
>>  		return -1;
>>  
>>  	if (mount(src, mi->mountpoint, tp->name,
>> -			mi->flags & (~MS_SHARED), mi->options) < 0) {
>> +			mi->flags & ~MS_CHANGE_TYPE_MASK, mi->options) < 0) {
>>  		pr_perror("Can't mount at %s", mi->mountpoint);
>>  		return -1;
>>  	}
>> -- 
>> 1.5.5.1
>>
> 
> .
> 



More information about the CRIU mailing list