<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-06-28 16:32 GMT+03:00 Pavel Emelyanov <span dir="ltr"><<a href="mailto:xemul@virtuozzo.com" target="_blank">xemul@virtuozzo.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div class=""><div class="h5">On 06/24/2016 11:38 PM, Eugene Batalov wrote:<br>
> Signed-off-by: Eugene Batalov <<a href="mailto:eabatalov89@gmail.com">eabatalov89@gmail.com</a>><br>
> ---<br>
> criu/files-reg.c | 34 +++++++++++++++++++++++-----------<br>
> 1 file changed, 23 insertions(+), 11 deletions(-)<br>
><br>
> diff --git a/criu/files-reg.c b/criu/files-reg.c<br>
> index 2f1c695..2b6a876 100644<br>
> --- a/criu/files-reg.c<br>
> +++ b/criu/files-reg.c<br>
> @@ -522,6 +522,26 @@ static void try_clean_ghost(struct remap_info *ri)<br>
> pr_perror(" `- XFail [%s] ghost", path);<br>
> }<br>
><br>
> +static int clean_one_remap(struct file_remap *remap, int rmntns_root)<br>
> +{<br>
> + int ret = 0;<br>
> + if (rmntns_root == -1)<br>
> + rmntns_root = mntns_get_root_by_mnt_id(remap->rmnt_id);<br>
> +<br>
> + if (rmntns_root < 0)<br>
> + return -1;<br>
> +<br>
> + pr_info("Unlink remap %s\n", remap->rpath);<br>
> +<br>
> + ret = unlinkat(rmntns_root, remap->rpath, remap->is_dir ? AT_REMOVEDIR : 0);<br>
> + if (ret < 0) {<br>
> + pr_perror("Couldn't unlink remap %s", remap->rpath);<br>
> + return -1;<br>
> + }<br>
> +<br>
> + return 0;<br>
> +}<br>
> +<br>
> void try_clean_remaps(int ns_fd)<br>
> {<br>
> struct remap_info *ri;<br>
> @@ -647,14 +667,8 @@ static int dump_ghost_file(int _fd, u32 id, const struct stat *st, dev_t phys_de<br>
> void remap_put(struct file_remap *remap)<br>
> {<br>
> mutex_lock(ghost_file_mutex);<br>
> - if (--remap->users == 0) {<br>
> - int mntns_root;<br>
> -<br>
> - pr_info("Unlink the ghost %s\n", remap->rpath);<br>
> -<br>
> - mntns_root = mntns_get_root_by_mnt_id(remap->rmnt_id);<br>
> - unlinkat(mntns_root, remap->rpath, 0);<br>
> - }<br>
> + if (--remap->users == 0)<br>
> + clean_one_remap(remap, -1);<br>
> mutex_unlock(ghost_file_mutex);<br>
> }<br>
><br>
> @@ -1514,9 +1528,7 @@ ext:<br>
><br>
> BUG_ON(!rfi->remap->users);<br>
> if (--rfi->remap->users == 0) {<br>
> - pr_info("Unlink the ghost %s\n", rfi->remap->rpath);<br>
> - mntns_root = mntns_get_root_by_mnt_id(rfi->remap->rmnt_id);<br>
> - unlinkat(mntns_root, rfi->remap->rpath, rfi->remap->is_dir ? AT_REMOVEDIR : 0);<br>
> + clean_one_remap(rfi->remap, mntns_root);<br>
<br>
</div></div>You change the behavior -- originall the mntns_root was re-initialized, but<br>
this patch forces it to get reused. Is that OK?<br></blockquote><div>No it's not right.</div><div>mntns_root before this hunk is initialized from rfi->rfe->mnt_id but in this hunk it should be initialized from <span style="color:rgb(80,0,80)">rfi-></span><span style="color:rgb(80,0,80)">remap->rmnt_id.</span><br></div><div>I've overlooked this very small patch. It is part of a bigger patchset. Sorry. Will resend proper version (v2) soon.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
> }<br>
><br>
> mutex_unlock(ghost_file_mutex);<br>
><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Best regards,<br>Eugene Batalov.</div>
</div></div>