[CRIU] About file lock

Pavel Emelyanov xemul at parallels.com
Sat Sep 29 12:28:29 EDT 2012


On 09/29/2012 12:32 PM, Gu Zheng wrote:
> On 2012/9/29 15:00, Pavel Emelyanov wrote:
>>> So I read the CRIU codes,and find that CRIU does not handle file locks.And I look up the TODO list on CRIU main page,do not find 
>>> any solution or plan about file locks.
>>
>> CRIU doesn't handle file locks, indeed.
>>
>>> Is it unnecessary to handle the file locks? or an oversight? Thanks!
>>
>> It's necessary to do it, but it's hard. You should somehow guarantee, that once you
>> terminated the processes you've dumped and the locks got dropped, this won't affect
>> anyone else. 
> 
> Sorry ,I don't clearly understand what the effect is,can you show me an example and explain it? Thanks :)

Task A takes lock on file FOO
Then task B takes lock on file FOO and gets blocked
You dump task A only. After this task A gets killed and FOO is unlocked
B waked up and takes FOO lock
You restore task A, it _thinks_ that it's in the middle of some atomic operation
with FOO, but it's not so.

>> This can be more or less safely be achieved by assuming that all flock
>> users live in the same container and support flocks for this case only.
> 
> This can handle the problem that you mentioned above only in the case that you dump and restore whole tasks in the container,is it right?

Yes. If you dump the whole container, and no external tasks depend on locks taken by it, it's safe.

>>
>>> _______________________________________________
>>> CRIU mailing list
>>> CRIU at openvz.org
>>> https://openvz.org/mailman/listinfo/criu
>>>
>>
>>
>>
>>
> 
> 





More information about the CRIU mailing list