From 74d1233b596c52ae8dc5da4730e6e3e48152023e Mon Sep 17 00:00:00 2001 From: Rajneesh Bhardwaj Date: Tue, 27 Apr 2021 19:08:57 -0400 Subject: [PATCH] criu/files: Don't cache fd ids for device files Restore operation fails when we perform CR operation of multiple independent proceses that have device files because criu caches the ids for the device files with same mnt_ids, inode pair. This change ensures that even in case of a cached id found for a device, a unique subid is generated and returned which is used for dumping. Suggested-by: Andrei Vagin Signed-off-by: Rajneesh Bhardwaj Signed-off-by: He Wenliang --- criu/file-ids.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/criu/file-ids.c b/criu/file-ids.c index 1b9d68888..772bd92cf 100644 --- a/criu/file-ids.c +++ b/criu/file-ids.c @@ -77,8 +77,14 @@ int fd_id_generate_special(struct fd_parms *p, u32 *id) fi = fd_id_cache_lookup(p); if (fi) { - *id = fi->id; - return 0; + if (p->stat.st_mode & (S_IFCHR | S_IFBLK)) { + /* Don't cache the id for mapped devices */ + *id = fd_tree.subid++; + return 1; + } else { + *id = fi->id; + return 0; + } } } -- 2.33.0