mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-22 11:55:23 -04:00
create whiteout when renaming file over existing whiteout
Create `whiteout` for cases if there is already a whiteout in the destination path and rename is called with flag RENAME_NOREPLACE. Signed-off-by: Aditya R <arajan@redhat.com>
This commit is contained in:
parent
878cb0ccad
commit
e5e4c5eb6e
12
main.c
12
main.c
@ -4631,9 +4631,17 @@ ovl_rename_direct (fuse_req_t req, fuse_ino_t parent, const char *name,
|
||||
ret = direct_renameat2 (srcfd, name, destfd,
|
||||
newname, flags|RENAME_WHITEOUT);
|
||||
}
|
||||
/* If the destination is a whiteout, just overwrite it. */
|
||||
/* If the destination is a whiteout, just overwrite it. */
|
||||
if (ret < 0 && errno == EEXIST)
|
||||
ret = direct_renameat2 (srcfd, name, destfd, newname, flags & ~RENAME_NOREPLACE);
|
||||
{
|
||||
ret = direct_renameat2(srcfd, name, destfd, newname, flags & ~RENAME_NOREPLACE);
|
||||
if (ret >= 0)
|
||||
{
|
||||
ret = create_whiteout(lo, pnode, name, false, false);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
if (ret < 0)
|
||||
{
|
||||
ret = direct_renameat2 (srcfd, name, destfd,
|
||||
|
Loading…
x
Reference in New Issue
Block a user