public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-patches@cygwin.com
Cc: Yoshinao Muramatsu <ysno@ac.auone-net.jp>
Subject: Re: [PATCH 0/3] fix unlink/rename failure in hyper-v container
Date: Sat, 18 Mar 2023 11:01:23 +0100	[thread overview]
Message-ID: <ZBWL85hJIlbZHc/D@calimero.vinschen.de> (raw)
In-Reply-To: <b5553609-8ce3-41fd-4215-2504a8491652@ac.auone-net.jp>

Hi Yoshinao,

On Mar 18 14:29, Yoshinao Muramatsu wrote:
> Hi Corinna.
> I'm Yoshinao Muramatsu. Thank you for your thoughtful guidance.
> I have not modified the patch yet,
> but I have made some observations and post the results.
> 
> I forgot to mention in my first post that there is a workaround
> for this issue, which is to use process isolation unless
> hyper-v isolation is absolutely necessary
> (mainly caused by build number difference between host and container).

Ok, but that's a propoerty we'll never be able to test.

> In the logs, here we can find some differences.
> But I believe it is unclear if it will always be so.
> If additional inspections are done, they will be costly.

Assuming we can pull some information from the filesystem flags, the
cost is negligible.  We just check bits in a filesystem bitmask.

> I would also like to see better support for POSIX unlink/rename
> semantics in the container mechanism.

Yeah, but... do you have high hopes?

Assuming we can fetch useful info from the filesystem flags, we could
basically do both, add your patch to have a workaround in case the
Windows call returns INVALID_PARAMETER, and an early test for a FS
flag which can be used down the road to avoid the workaround.

> Therefore, I think it is not a bad idea to simply retry rather than spending
> time every time to check the conditions to deal with rare situations.
> However, in certain situations it happens all the time.
> (So if we can cache it that would be great.)
> But performance in the vast majority of other situations is more important.

The filesystem info is cached, so the filesystem flags are only checked
the first time we open a file on the filesystem.

> In the following logs, c:\ is the normal ntfs volume in the container,
> andc:\opt is the volume of the bind mounted host.
> Where the differences are
> - 0x00000020 Supports Disk Quotas
> - 0x01000000 Supports Open By FileID
> - 0x02000000 Supports USN Journal

I just updated the csih package to 0.9.13.  The getVolInfo tool
now prints *all* known filesystem flags.

> == hyper-v container (has issue)
> $ mount
> C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
> C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
> C:/cygwin64 on / type ntfs (binary,auto)
> C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
> 
> $ /usr/lib/csih/getVolInfo.exe /cygdrive/c/
> Device Type        : 7
> Characteristics    : 20020
> Volume Name        : <>
> Serial Number      : 3456656850
> Max Filenamelength : 255
> Filesystemname     : <NTFS>
> Flags              : 1c706df
> ...snip...
> 
> $ /usr/lib/csih/getVolInfo.exe /cygdrive/c/opt/
> Device Type        : 7
> Characteristics    : 20020
> Volume Name        : <>
> Serial Number      : 955187689
> Max Filenamelength : 255
> Filesystemname     : <NTFS>
> Flags              : 2c706ff
> ...snip...

This is disappointing.  One of the newer filesystem flags is
0x400, FILE_SUPPORTS_POSIX_UNLINK_RENAME.  As you can see,
the flag is set.  But the POSIX functionality doesn't work
here, right?

However, what's really curious here is the fact that the
FILE_SUPPORTS_OPEN_BY_FILE_ID flag is missing.

NTFS always supports this since Windows 2003!  So we could
use this flag as indicator that, probably, POSIX rename/unlink
won't work.


Corinna

  reply	other threads:[~2023-03-18 11:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 14:43 YO4
2023-03-17 14:43 ` [PATCH 1/3] fix unlink in container YO4
2023-03-17 14:43 ` [PATCH 2/3] fix rename " YO4
2023-03-17 14:43 ` [PATCH 3/3] log disabling posix semantics YO4
2023-03-17 19:15 ` [PATCH 0/3] fix unlink/rename failure in hyper-v container Corinna Vinschen
2023-03-18  5:29   ` Yoshinao Muramatsu
2023-03-18 10:01     ` Corinna Vinschen [this message]
2023-03-20 13:06       ` Yoshinao Muramatsu
2023-03-20 14:51         ` Corinna Vinschen
2023-03-20 14:54           ` Corinna Vinschen
2023-03-20 20:37           ` Corinna Vinschen
2023-03-21 15:32             ` Yoshinao Muramatsu
2023-03-21 17:58               ` Corinna Vinschen
2023-03-23 16:40                 ` Yoshinao Muramatsu
2023-03-24 11:54                   ` Corinna Vinschen
2023-03-24 13:20                     ` Jon Turney
2023-03-24 13:22                       ` Corinna Vinschen
2023-03-24 14:20                         ` Jon Turney
2023-03-24 13:48                     ` Yoshinao Muramatsu
2023-03-20 11:50   ` [PATCH 0/3] fix unlink/rename failure in hyper-v container(regenerate) Yoshinao Muramatsu
2023-03-20 11:51     ` [PATCH 1/3] fix unlink in container Yoshinao Muramatsu
2023-03-20 11:51     ` [PATCH 2/3] fix rename " Yoshinao Muramatsu
2023-03-20 11:51     ` [PATCH 3/3] log disabling posix semantics Yoshinao Muramatsu
2023-03-20 12:12     ` [PATCH 0/3] fix unlink/rename failure in hyper-v container(regenerate) Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZBWL85hJIlbZHc/D@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-patches@cygwin.com \
    --cc=ysno@ac.auone-net.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).