Skip to content

Commit

Permalink
remap: Rename global lock
Browse files Browse the repository at this point in the history
Now this lock is only needed to serialize remap open
code, so name it such.

✓ travis-ci: success for Sanitize initialization bits
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
  • Loading branch information
xemul authored and avagin committed Jun 13, 2017
1 parent a534c76 commit 237bd26
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions criu/files-reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ struct ghost_file {
static u32 ghost_file_ids = 1;
static LIST_HEAD(ghost_files);

static mutex_t *ghost_file_mutex;
/*
* When opening remaps we first create a link on the remap
* target, then open one, then unlink. In case the remap
* source has more than one instance, these tree steps
* should be serialized with each other.
*/
static mutex_t *remap_open_lock;

static LIST_HEAD(remaps);

Expand Down Expand Up @@ -1446,7 +1452,7 @@ int open_path(struct file_desc *d,
BUG();
}

mutex_lock(ghost_file_mutex);
mutex_lock(remap_open_lock);
if (rfi->remap->is_dir) {
/*
* FIXME Can't make directory under new name.
Expand Down Expand Up @@ -1532,7 +1538,7 @@ int open_path(struct file_desc *d,
rm_parent_dirs(mntns_root, rfi->path, level);
}

mutex_unlock(ghost_file_mutex);
mutex_unlock(remap_open_lock);
}
if (orig_path)
rfi->path = orig_path;
Expand Down Expand Up @@ -1719,11 +1725,11 @@ static struct collect_image_info reg_file_cinfo = {

int prepare_shared_reg_files(void)
{
ghost_file_mutex = shmalloc(sizeof(*ghost_file_mutex));
if (!ghost_file_mutex)
remap_open_lock = shmalloc(sizeof(*remap_open_lock));
if (!remap_open_lock)
return -1;

mutex_init(ghost_file_mutex);
mutex_init(remap_open_lock);
return 0;
}

Expand Down

0 comments on commit 237bd26

Please sign in to comment.