[CRIU] [PATCH] files-reg: Rework strip_deleted
Saied Kazemi
saied at google.com
Tue Jul 28 11:21:34 PDT 2015
Hi Cyrill,
Thanks for the patch. As you've probably already seen on Github, the issue
is that during dump new->root is saved as /null//deleted, causing failure
during restore.
Although with your patch strip_deleted() removes both " (deleted)" and
"//deleted", new->root never makes it to strip_deleted().
As a quick test, I removed "//deleted" from new->root in
parse_mountinfo_ent() and C/R works!
Hope this helps.
--Saied
On Tue, Jul 28, 2015 at 1:03 AM, Cyrill Gorcunov <gorcunov at openvz.org>
wrote:
> At moment here are two postfixes kernel supports,
> so rework the routine to handle both.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> files-reg.c | 30 +++++++++++++++++++++++-------
> 1 file changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/files-reg.c b/files-reg.c
> index 2a6269b2a550..1a89e45a89bd 100644
> --- a/files-reg.c
> +++ b/files-reg.c
> @@ -647,16 +647,32 @@ static inline bool nfs_silly_rename(char *rpath,
> const struct fd_parms *parms)
>
> static void strip_deleted(struct fd_link *link)
> {
> - const char postfix[] = " (deleted)";
> - const size_t plen = strlen(postfix);
> + struct dcache_prepends {
> + const char *str;
> + size_t len;
> + } static const prepends[] = {
> + {
> + .str = " (deleted)",
> + .len = 10,
> + }, {
> + .str = "//deleted",
> + .len = 10,
> + }
> + };
> + size_t i;
> +
> + for (i = 0; i < ARRAY_SIZE(prepends); i++) {
> + size_t at;
> +
> + if (link->len <= prepends[i].len)
> + continue;
>
> - if (link->len > plen) {
> - size_t at = link->len - plen;
> - if (!strcmp(&link->name[at], postfix)) {
> + at = link->len - prepends[i].len;
> + if (!strcmp(&link->name[at], prepends[i].str)) {
> pr_debug("Stip %s' tag from '%s'\n",
> - postfix, link->name);
> + prepends[i].str, link->name);
> link->name[at] = '\0';
> - link->len -= plen;
> + link->len -= prepends[i].len;
> }
> }
> }
> --
> 2.4.3
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20150728/250c5a3f/attachment.html>
More information about the CRIU
mailing list