mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-08-03 18:05:58 -04:00
rmdir: catch ENOTEMPTY also when deleting a dir from a lower layer
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
616119093a
commit
996f297f9d
30
main.c
30
main.c
@ -1578,6 +1578,26 @@ do_rm (fuse_req_t req, fuse_ino_t parent, const char *name, bool dirp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dirp)
|
||||||
|
{
|
||||||
|
size_t c;
|
||||||
|
|
||||||
|
/* Re-load the directory. */
|
||||||
|
node = load_dir (lo, node, node->layer, node->path, node->name);
|
||||||
|
if (node == NULL)
|
||||||
|
{
|
||||||
|
fuse_reply_err (req, errno);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
c = count_dir_entries (node);
|
||||||
|
if (c)
|
||||||
|
{
|
||||||
|
fuse_reply_err (req, ENOTEMPTY);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (node->layer == get_upper_layer (lo))
|
if (node->layer == get_upper_layer (lo))
|
||||||
{
|
{
|
||||||
node->hidden_dirfd = node->layer->fd;
|
node->hidden_dirfd = node->layer->fd;
|
||||||
@ -1587,7 +1607,6 @@ do_rm (fuse_req_t req, fuse_ino_t parent, const char *name, bool dirp)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
size_t c = 0;
|
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fd = TEMP_FAILURE_RETRY (openat (get_upper_layer (lo)->fd, node->path, O_DIRECTORY));
|
fd = TEMP_FAILURE_RETRY (openat (get_upper_layer (lo)->fd, node->path, O_DIRECTORY));
|
||||||
@ -1597,15 +1616,6 @@ do_rm (fuse_req_t req, fuse_ino_t parent, const char *name, bool dirp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->children)
|
|
||||||
c = count_dir_entries (node);
|
|
||||||
if (c)
|
|
||||||
{
|
|
||||||
close (fd);
|
|
||||||
fuse_reply_err (req, ENOTEMPTY);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
{
|
{
|
||||||
dp = fdopendir (fd);
|
dp = fdopendir (fd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user