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 <avagin@gmail.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
This commit is contained in:
Rajneesh Bhardwaj 2021-04-27 19:08:57 -04:00 committed by Andrei Vagin
parent 7b6239b6dd
commit 74d1233b59

View file

@ -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;
}
}
}