public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Duplicates in /proc/partitions
Date: Thu, 19 Aug 2021 17:37:38 +0200	[thread overview]
Message-ID: <YR56wh+j3WhcT+Vx@calimero.vinschen.de> (raw)
In-Reply-To: <DM8PR09MB70950620A1B35CE661FA090FA5C09@DM8PR09MB7095.namprd09.prod.outlook.com>

On Aug 19 15:15, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin wrote:
> > > loop is not working atomically.  If a new object is inserted into the
> > > dir preceeding the currently handled entry (which, on a reliable system
> > > should *never* occur), the entry is moved by one, and the next
> > > NtQueryDirectoryObject call returns the same object again.
> 
> Very interesting...  What would be inserted in the directory on my machine,
> in between the calls in that original test program?  It was the only one
> running there, explicitly, I mean...

This also occurs all the time on my system.  It seems to be quite normal
in fact.  That's the only action explaining that the same entry gets
different context values when running the loop multiple times.  Observing
the changing context value was what gave me the idea to trigger this by
creating a symlink to the \Device dir at a certain iteration in the
loop, and that in turn allowed me to reproduce the problem.

> And exclusion of the loop of partition
> enumeration seemed to cancel the insertion?

Not as such.  Probably this just changed the timing.

> one exhibition of the problem, and the other one on my machine here is
> different, and not well understood, but with the same side effect,
> unfortunately.
> 
> > Anyway, would you mind to test the below new proc_partition.c as well
> 
> Looks promising indeed!  No duplicates:
> 
> $ ./proc_partition
> bytes_read = 34346, context = 461, status = 0x00000000
> major minor  #blocks  name   win-mounts
> 
>     8     0 500107608 sda (461, Harddisk0)
>     8     1    102400 sda1
>     8     2 488280064 sda2    C:\
>     8    16 1000204632 sdb (461, Harddisk1)
>     8    17 1000202240 sdb1    D:\
>     8    32 1000204632 sdc (461, Harddisk2)
>     8    33 1000202240 sdc1    G:\
>     8    48 1000204632 sdd (461, Harddisk3)
>     8    49 1000202240 sdd1    I:\
>     8    64 234431064 sde (461, Harddisk4)
>     8    65 234428416 sde1    F:\
> DeviceIoControl (Harddisk5\Partition0, IOCTL_DISK_GET_PARTITION_INFO{_EX}) 5    8    80         0 sdf (461, Harddisk5)
> 
> > as the latest snapshot I just uploaded to https://cygwin.com/snapshots/?
> 
> I'll have to do that later, not now.  But I'll report once I have a change to try it out.

Great!  Looking forward to it.


Thanks,
Corinna

  reply	other threads:[~2021-08-19 15:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 10:56 David Balažic
2021-08-13 15:17 ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2021-08-16 14:51 ` Corinna Vinschen
2021-08-16 16:56   ` Brian Inglis
2021-08-16 17:23     ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2021-08-16 18:49     ` Corinna Vinschen
2021-08-16 21:54       ` Brian Inglis
2021-08-17 12:57       ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2021-08-17 13:51         ` Corinna Vinschen
2021-08-18 14:18           ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2021-08-18 15:01             ` Corinna Vinschen
2021-08-18 18:18               ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2021-08-18 18:27                 ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2021-08-18 18:36                   ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2021-08-19 10:03                     ` Corinna Vinschen
2021-08-19 11:26                       ` Corinna Vinschen
2021-08-19 14:48                         ` Corinna Vinschen
2021-08-19 15:15                           ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2021-08-19 15:37                             ` Corinna Vinschen [this message]
2021-08-19 15:46                               ` Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2021-08-19 19:19                                 ` Corinna Vinschen
2021-08-19  9:37                 ` 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=YR56wh+j3WhcT+Vx@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin@cygwin.com \
    /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).