[CRIU] [PATCH 3/4] mount: Handle deleted bindmounts

Andrey Wagin avagin at gmail.com
Wed Aug 26 05:12:48 PDT 2015


2015-08-26 14:38 GMT+03:00 Cyrill Gorcunov <gorcunov at gmail.com>:
> On Wed, Aug 26, 2015 at 02:30:52PM +0300, Andrew Vagin wrote:
>> On Mon, Aug 17, 2015 at 11:09:48PM +0300, Cyrill Gorcunov wrote:
>> > @@ -1990,11 +1994,25 @@ static int do_bind_mount(struct mount_info *mi)
>> >             root = rpath;
>> >  do_bind:
>> >             pr_info("\tBind %s to %s\n", root, mi->mountpoint);
>> > -           if (mount(root, mi->mountpoint, NULL,
>> > -                                   MS_BIND, NULL) < 0) {
>> > +
>> > +           if (unlikely(mi->deleted)) {
>> > +                   if (mkdir(root, 0700)) {
>>
>> https://github.com/xemul/criu/issues/9
>> In this issue a file was bind-mounted. Can we handle this case?
>
> Not sure I follow. If the source has been deleted there is no
> way to figure out if it was a file or directory, you mean this?
> Or something else?

We can call stat() and it will show whether it was a file or a directory.

[root at avagin-fc19-cr ~]# touch  a b
[root at avagin-fc19-cr ~]# mount --bind a b
[root at avagin-fc19-cr ~]# unlink  a
[root at avagin-fc19-cr ~]# cat /proc/self/mountinfo
95 51 252:3 /root/a//deleted /root/b rw,relatime shared:1 - ext4
/dev/vda3 rw,data=ordered
[root at avagin-fc19-cr ~]# stat b
  File: ‘b’
  Size: 0         Blocks: 0          IO Block: 4096   regular empty file
Device: fc03h/64515d Inode: 285789      Links: 0
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2015-08-26 15:10:04.032989298 +0300
Modify: 2015-08-26 15:10:04.032989298 +0300
Change: 2015-08-26 15:10:13.202990391 +0300
 Birth: -



More information about the CRIU mailing list