WinFsp 2021.1 Beta3 POSIX unlink and new Delete design

54 views
Skip to first unread message

Bill Zissimopoulos

unread,
Nov 22, 2021, 7:28:41 AM11/22/21
to WinFsp

Please note that I have discovered a problem in how WinFsp implements POSIX unlink in the latest Beta (WinFsp 2021.1 Beta3). Unfortunately this flaw may invalidate the new Delete design. Please hold off adopting the new Delete design for now.

 

The problem is the following: In the WinFsp implementation of POSIX unlink (as it appears in WinFsp 2021.1 Beta3) the directory entry of a file is deleted as soon as the SetInformation with FileDispositionInformationEx request is completed. Unfortunately this appears to be incorrect. The correct behavior appears to be that the directory entry of a file is deleted as soon as the handle that was used to issue the SetInformation / FileDispositionInformationEx request is closed.

 

To make this more concrete if you issue the following (pseudo-)sequence:

 

       Handle = OpenFile(L"file");

 

       DeleteHandle = OpenFile(L"file");

       SetInformation(DeleteHandle, FileDispositionInformationEx, PosixSemantics);

              // The directory entry for the file remains here even under PosixSemantics.

              // WinFsp erroneously removes the directory entry here under PosixSemantics.

       CloseHandle(DeleteHandle);

              // The directory entry for the file is now gone under PosixSemantics.

 

       // Original Handle is still valid and can be used.

       ReadFile(Handle, …);

 

Please note that this does not affect any existing file systems or any file systems that have not adopted the new Delete design.

 

Thanks.

 

Bill

 

Bill Zissimopoulos

unread,
Nov 25, 2021, 12:33:39 PM11/25/21
to Bill Zissimopoulos, WinFsp

The Delete design as it was presented in the last Beta (WinFsp 2021.1 Beta3) has now been reverted.

 

However WinFsp will continue to support POSIX unlink / rename going forward:

 

  • Set the FSP_FSCTL_VOLUME_PARAMS :: SupportsPosixUnlinkRename in order to enable the POSIX unlink / rename support.

 

  • Handle file deletion in Cleanup with the FspCleanupDelete flag set like before. However when the SupportsPosixUnlinkRename flag is set, you may receive a Cleanup / FspCleanupDelete while there are other open file handles.

 

FUSE file systems have POSIX unlink / rename support enabled by default. However you can disable it by passing the `-o LegacyUnlinkRename` command line option.

 

The upcoming Beta (renamed to WinFsp 2022 Beta4) will have those changes included.

 

Thanks.

 

Bill

--
You received this message because you are subscribed to the Google Groups "WinFsp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to winfsp+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/winfsp/MWHPR0701MB3835CD049849F186CFBC4A0EBC9F9%40MWHPR0701MB3835.namprd07.prod.outlook.com.

Reply all
Reply to author
Forward
0 new messages