Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In container posix semantics #141

Open
wants to merge 3 commits into
base: msys2-3.4.6
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 22 additions & 1 deletion winsup/cygwin/syscalls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,14 @@ _unlink_nt (path_conv &pc, bool shareable)
/* Trying to delete in-use executables and DLLs using
FILE_DISPOSITION_POSIX_SEMANTICS returns STATUS_CANNOT_DELETE.
Fall back to the default method. */
if (status != STATUS_CANNOT_DELETE)
/* Additionaly that returns STATUS_INVALID_PARAMETER
on a bind mounted fs in hyper-v container. Falling back too. */
if (status != STATUS_CANNOT_DELETE
&& status != STATUS_INVALID_PARAMETER)
goto out;
debug_printf ("NtSetInformationFile (%S, FileDispositionInformationEx)"
" returns %y with posix semantics. Disable it and retry.",
pc.get_nt_native_path (), status);
Comment on lines 738 to +741

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
goto out;
debug_printf ("NtSetInformationFile (%S, FileDispositionInformationEx)"
" returns %y with posix semantics. Disable it and retry.",
pc.get_nt_native_path (), status);
{
debug_printf ("NtSetInformationFile returns %y "
"with posix semantics. Disable it and retry.", status);
goto out;
}

}

/* If the R/O attribute is set, we have to open the file with
Expand Down Expand Up @@ -2435,6 +2441,7 @@ rename2 (const char *oldpath, const char *newpath, unsigned int at2flags)
&& !oldpc.isremote ()
&& oldpc.fs_is_ntfs ();

ignore_posix_semantics_retry:
/* Opening the file must be part of the transaction. It's not sufficient
to call only NtSetInformationFile under the transaction. Therefore we
have to start the transaction here, if necessary. Don't start
Expand Down Expand Up @@ -2679,6 +2686,20 @@ rename2 (const char *oldpath, const char *newpath, unsigned int at2flags)
unlink_nt (*removepc);
res = 0;
}
else if (use_posix_semantics && status == STATUS_INVALID_PARAMETER)
{
/* NtSetInformationFile returns STATUS_INVALID_PARAMETER
on a bind mounted file system in hyper-v container
with FILE_RENAME_POSIX_SEMANTICS.
Disable the use_posix semntics flag and retry. */
debug_printf ("NtSetInformationFile "
"(%S, %S, FileRenameInformationEx) failed "
"with posix semantics. Disable it and retry.",
oldpc.get_nt_native_path (),
newpc.get_nt_native_path ());
use_posix_semantics = 0;
goto ignore_posix_semantics_retry;
}
else
__seterrno_from_nt_status (status);
}
Expand Down