[CRIU] [PATCH v5 15/15] mount: create target directory for AutoFS indirect mounts.

Pavel Emelyanov xemul at virtuozzo.com
Wed Jan 27 08:13:51 PST 2016


On 01/27/2016 06:59 PM, Stanislav Kinsburskiy wrote:
> 
> 
> 27.01.2016 15:37, Pavel Emelyanov пишет:
>> On 01/27/2016 03:05 PM, Stanislav Kinsburskiy wrote:
>>> In case of mounting AutoFS indirect mount points, target dentry doesn't exist
>>> and has to be created.
>>>
>>> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
>>> ---
>>>   autofs.c         |   14 ++++++++++++++
>>>   include/autofs.h |    1 +
>>>   mount.c          |   14 ++++++++++++++
>>>   3 files changed, 29 insertions(+)
>>>
>>> diff --git a/autofs.c b/autofs.c
>>> index 90a3691..e1001bd 100644
>>> --- a/autofs.c
>>> +++ b/autofs.c
>>> @@ -776,6 +776,20 @@ static int autofs_restore_entry(struct mount_info *mi, AutofsEntry **entry)
>>>   	return 0;
>>>   }
>>>   
>>> +bool autofs_indirect_mount(struct mount_info *mi)
>>> +{
>>> +	struct mount_info *parent = mi->parent;
>>> +	autofs_info_t *info;
>>> +
>>> +	if (strcmp(parent->fstype->name, "autofs"))
>>> +		return false;
>>> +
>>> +	info = mi->parent->private;
>>> +	BUG_ON(info == NULL);
>>> +
>>> +	return info->entry->mode != AUTOFS_MODE_DIRECT;
>>> +}
>>> +
>>>   int autofs_mount(struct mount_info *mi, const char *source, const
>>>   		 char *filesystemtype, unsigned long mountflags)
>>>   {
>>> diff --git a/include/autofs.h b/include/autofs.h
>>> index 4c84b70..41b2550 100644
>>> --- a/include/autofs.h
>>> +++ b/include/autofs.h
>>> @@ -12,6 +12,7 @@ int autofs_parse(struct mount_info *pm);
>>>   int autofs_dump(struct mount_info *pm);
>>>   int autofs_mount(struct mount_info *mi, const char *source, const
>>>   		 char *filesystemtype, unsigned long mountflags);
>>> +bool autofs_indirect_mount(struct mount_info *mi);
>>>   
>>>   #include <linux/auto_fs.h>
>>>   
>>> diff --git a/mount.c b/mount.c
>>> index 69afc1c..a3f840a 100644
>>> --- a/mount.c
>>> +++ b/mount.c
>>> @@ -2248,6 +2248,20 @@ static int do_new_mount(struct mount_info *mi)
>>>   	if (remount_ro)
>>>   		sflags &= ~MS_RDONLY;
>>>   
>>> +	pr_info("%s: mi: %p, mountpoint: %s\n", __func__, mi, mi->mountpoint);
>>> +	if (autofs_indirect_mount(mi)) {
>> Erm... Can we have this outside of the generic code? E.g. in autofs_mount
>> check for mi->children and go mkdir() for all of them?
> 
> Unfortunatelly, mi->children list is empty on autofs mount call.

Are there any auto-mounts at all? The tree of mi's is created on collect stage, 
much earlier than ->mount-s are called.

-- Pavel


More information about the CRIU mailing list