mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-02 15:25:21 +00:00
reg-files: No need for atomic @users
We're under lock anyway. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
997b295d67
commit
a3c6869ca1
@@ -37,7 +37,7 @@ struct ghost_file {
|
|||||||
char *path;
|
char *path;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
atomic_t users;
|
unsigned int users;
|
||||||
};
|
};
|
||||||
|
|
||||||
static u32 ghost_file_ids = 1;
|
static u32 ghost_file_ids = 1;
|
||||||
@@ -116,10 +116,10 @@ static int open_remap_ghost(struct reg_file_info *rfi,
|
|||||||
close(gfd);
|
close(gfd);
|
||||||
|
|
||||||
gf->id = rfe->remap_id;
|
gf->id = rfe->remap_id;
|
||||||
atomic_set(&gf->users, 0);
|
gf->users = 0;
|
||||||
list_add_tail(&gf->list, &ghost_files);
|
list_add_tail(&gf->list, &ghost_files);
|
||||||
gf_found:
|
gf_found:
|
||||||
atomic_inc(&gf->users);
|
gf->users++;
|
||||||
rfi->ghost = gf;
|
rfi->ghost = gf;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -370,7 +370,8 @@ static int open_path(struct file_desc *d,
|
|||||||
|
|
||||||
if (rfi->ghost) {
|
if (rfi->ghost) {
|
||||||
unlink(rfi->path);
|
unlink(rfi->path);
|
||||||
if (atomic_dec_and_test(&rfi->ghost->users)) {
|
BUG_ON(!rfi->ghost->users);
|
||||||
|
if (--rfi->ghost->users == 0) {
|
||||||
pr_info("Unlink the ghost %s\n", rfi->ghost->path);
|
pr_info("Unlink the ghost %s\n", rfi->ghost->path);
|
||||||
unlink(rfi->ghost->path);
|
unlink(rfi->ghost->path);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user