Skip to content

Commit 7e4c37c

Browse files
Brian DanielsDatabean
authored andcommitted
Remove dirs and files across mounts in containers
When running in a container, the root filesystem uses OverlayFS. Due to a quirk of the OverlayFS implementation, nftw() will not include certain files in the walk since their device number differs from the parent directory. We remove the FTW_MOUNT flag to ensure that all child file and directories are deleted before deleting the parent. Bug: 465804122
1 parent de717b4 commit 7e4c37c

File tree

1 file changed

+1
-1
lines changed
  • base/cvd/cuttlefish/common/libs/utils

1 file changed

+1
-1
lines changed

base/cvd/cuttlefish/common/libs/utils/files.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ Result<void> RecursivelyRemoveDirectory(const std::string& path) {
330330
return 0;
331331
};
332332

333-
if (nftw(path.c_str(), callback, 128, FTW_DEPTH | FTW_MOUNT | FTW_PHYS) < 0) {
333+
if (nftw(path.c_str(), callback, 128, FTW_DEPTH | FTW_PHYS) < 0) {
334334
return CF_ERRNO("Failed to remove directory \""
335335
<< path << "\": " << strerror(errno));
336336
}

0 commit comments

Comments
 (0)