RFR: 8356127: (fs) UnixFileSystemProvider.implDelete could save a syscall in some cases [v5]
Alan Bateman
alanb at openjdk.org
Sat May 10 08:07:51 UTC 2025
On Fri, 9 May 2025 16:56:09 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Modify `UnixFileSystemProvider.implDelete` to attempt first to delete the file using `unlink` and, if that fails, fall back to using `rmdir` if the file is a directory.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8356127: Tweak previous commit
I think we have to cautious and spend more time understanding the behavior of unlink with non-empty directories. I'm pretty sure that back in SunOS and UFS days that a non-empty directory could be unlinked, think cleanup when doing the next fsck. I understand that the proposal is do this on Linux only and it will work for local file systems. However, it is not clear to me that this is reliable with remote file systems. NFSv4 did make changes to support exactly what it is doing proposed but I worry there are other remote file systems where we might not get the ENOTEMPTY. Doing a statvfs to check the file system type would work but probably more expensive that the stat that we do now to check if the file is a directory.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25107#issuecomment-2868618444
More information about the nio-dev
mailing list