[CRIU] [PATCH 3/7] files-reg: Allocate the complete ghost file structure in shared memory

Pavel Emelyanov xemul at parallels.com
Wed Dec 5 14:59:09 EST 2012


On 12/05/2012 11:54 PM, Cyrill Gorcunov wrote:
> On Wed, Dec 05, 2012 at 11:47:49PM +0400, Pavel Emelyanov wrote:
>> On 12/03/2012 07:27 PM, Cyrill Gorcunov wrote:
>>> Inotify will need to have an ability to access path generated for
>>> ghost files thus we need this item being shared.
>>>
>>> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
>>> ---
>>>  files-reg.c | 7 ++-----
>>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> Why do we need the path string in shared memory?
> 
> Because we might need access the path from another process.
> Say task 1 opens file, then forks then task 2 hooks a watch
> on it and then task 1 deletes it.

This is how it currently works -- tasks open ghosts in _their_
context, while they were created by crtools master process. The
shmalloc is only required when you want to _modify_ memory from
sub-tasks. Reading will work even on regular malloc.


More information about the CRIU mailing list