[CRIU] [PATCH 1/3 v2] files-reg: Rework strip_deleted
Cyrill Gorcunov
gorcunov at gmail.com
Mon Aug 10 11:30:07 PDT 2015
On Mon, Aug 10, 2015 at 11:04:26AM -0700, Saied Kazemi wrote:
> Hi Cyrill,
> Applied the patches to the head as of today but unfortunately they didn't
> fix the issue and I still get the following restore error:
> (00.017142) Â Â Â 1: Â Â Bind ./dev/null//deleted to ./proc/kcore
> (00.017156) Â Â Â 1: Error (mount.c:2013): Can't mount at ./proc/kcore:
> Not a directory
> (00.036744) Error (cr-restore.c:1933): Restoring FAILED.
> Examining mountpoint-11.img, I can see /null//deleted, so //deleted wasn't
> stripped :(
Heh, there were a typo in first patch. Could you please use this one instead.
-------------- next part --------------
>From 1faf27d399599962bdccb64b6b279992d28c14ee Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Tue, 28 Jul 2015 10:59:08 +0300
Subject: [PATCH 1/3] files-reg: Rework strip_deleted
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 2812e7895bed..4bb3f00c4fc8 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -641,16 +641,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 = 9,
+ }
+ };
+ 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
More information about the CRIU
mailing list