Skip to content

Commit

Permalink
criu/files: Don't cache fd ids for device files
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Rajneesh Bhardwaj <[email protected]>
  • Loading branch information
rajbhar authored and adrianreber committed Sep 23, 2021
1 parent d3b62a0 commit 0c38a94
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions criu/file-ids.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit 0c38a94

Please sign in to comment.