diff --git a/criu/include/mount.h b/criu/include/mount.h index 519a34d2a..3067e4088 100644 --- a/criu/include/mount.h +++ b/criu/include/mount.h @@ -26,6 +26,10 @@ struct ns_id; */ #define REMOUNTED_RW_SERVICE 2 +struct rst_mount_info { + int remounted_rw; +}; + struct mount_info { int mnt_id; int parent_mnt_id; @@ -86,7 +90,8 @@ struct mount_info { struct list_head postpone; int is_overmounted; - int *remounted_rw; + + struct rst_mount_info *rmi; void *private; /* associated filesystem data */ }; diff --git a/criu/mount.c b/criu/mount.c index 3421ef491..5fdd60cda 100644 --- a/criu/mount.c +++ b/criu/mount.c @@ -2955,11 +2955,12 @@ struct mount_info *mnt_entry_alloc(bool rst) new = xzalloc(sizeof(struct mount_info)); if (new) { if (rst) { - new->remounted_rw = shmalloc(sizeof(int)); - if (!new->remounted_rw) { + new->rmi = shmalloc(sizeof(struct rst_mount_info)); + if (!new->rmi) { xfree(new); return NULL; } + memset(new->rmi, 0, sizeof(struct rst_mount_info)); } new->fd = -1; new->is_overmounted = -1; @@ -4073,9 +4074,9 @@ int try_remount_writable(struct mount_info *mi, bool ns) remounted = REMOUNTED_RW_SERVICE; /* All mounts in mntinfo list should have it on restore */ - BUG_ON(mi->remounted_rw == NULL); + BUG_ON(mi->rmi == NULL); - if (mi->flags & MS_RDONLY && !(*mi->remounted_rw & remounted)) { + if (mi->flags & MS_RDONLY && !(mi->rmi->remounted_rw & remounted)) { if (mnt_is_overmounted(mi)) { pr_err("The mount %d is overmounted so paths are invisible\n", mi->mnt_id); return -1; @@ -4098,7 +4099,7 @@ int try_remount_writable(struct mount_info *mi, bool ns) if (call_helper_process(ns_remount_writable, mi)) return -1; } - *mi->remounted_rw |= remounted; + mi->rmi->remounted_rw |= remounted; } return 0; @@ -4113,7 +4114,7 @@ static int __remount_readonly_mounts(struct ns_id *ns) if (ns && mi->nsid != ns) continue; - if (!(*mi->remounted_rw & REMOUNTED_RW)) + if (!(mi->rmi->remounted_rw & REMOUNTED_RW)) continue; /*