mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-10 15:56:25 -04:00
file, open: avoid deleting the whiteout if possible
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
6dbc45b821
commit
dd744c7fc2
6
main.c
6
main.c
@ -2933,6 +2933,7 @@ ovl_do_open (fuse_req_t req, fuse_ino_t parent, const char *name, int flags, mod
|
|||||||
struct ovl_node *p;
|
struct ovl_node *p;
|
||||||
const struct fuse_ctx *ctx = fuse_req_ctx (req);
|
const struct fuse_ctx *ctx = fuse_req_ctx (req);
|
||||||
char wd_tmp_file_name[32];
|
char wd_tmp_file_name[32];
|
||||||
|
bool need_delete_whiteout = true;
|
||||||
|
|
||||||
if ((flags & O_CREAT) == 0)
|
if ((flags & O_CREAT) == 0)
|
||||||
{
|
{
|
||||||
@ -2951,6 +2952,9 @@ ovl_do_open (fuse_req_t req, fuse_ino_t parent, const char *name, int flags, mod
|
|||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (p->loaded && n == NULL)
|
||||||
|
need_delete_whiteout = false;
|
||||||
|
|
||||||
sprintf (wd_tmp_file_name, "%lu", get_next_wd_counter ());
|
sprintf (wd_tmp_file_name, "%lu", get_next_wd_counter ());
|
||||||
|
|
||||||
ret = asprintf (&path, "%s/%s", p->path, name);
|
ret = asprintf (&path, "%s/%s", p->path, name);
|
||||||
@ -2964,7 +2968,7 @@ ovl_do_open (fuse_req_t req, fuse_ino_t parent, const char *name, int flags, mod
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
if (delete_whiteout (lo, -1, p, name) < 0)
|
if (need_delete_whiteout && delete_whiteout (lo, -1, p, name) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
n = make_ovl_node (path, get_upper_layer (lo), name, 0, false, p, lo->fast_ino_check);
|
n = make_ovl_node (path, get_upper_layer (lo), name, 0, false, p, lo->fast_ino_check);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user