This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Initialize IO_STATUS_BLOCK for pread, pwrite


On Nov 28 00:03, Mark Geisert wrote:
> Mark Geisert wrote:
> > ---
> >  winsup/cygwin/fhandler_disk_file.cc | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
> > index 5dfcae4d9..2ead9948c 100644
> [...]
> 
> Oops, I neglected to include an explanatory comment. Issuing simultaneous
> pwrite(s) on one file descriptor from multiple threads, as one might do in a
> forthcoming POSIX aio implementation, sometimes results in garbage status in
> the IO_STATUS_BLOCK on return from NtWriteFile(). Zeroing beforehand made
> the issue go away.
> 
> This is mildly concerning to me because there are many other uses of
> IO_STATUS_BLOCK in the Cygwin DLL that haven't seemed to have needed
> initialization.
> 
> Puzzledly,

Ok, let's start with, why did you tweak pread if you only observed
a problem in pwrite?  In terms of pread, we already have a very recent
patch series:

https://sourceware.org/git/?p=newlib-cygwin.git;a=commitdiff;h=46702f92ea49
https://sourceware.org/git/?p=newlib-cygwin.git;a=commitdiff;h=c983aa48798d
https://sourceware.org/git/?p=newlib-cygwin.git;a=commitdiff;h=181fe5d2edac

In this case it turned out that the problem was related to hitting EOF.
I wonder if we hit a similar problem here.

Two points:

- Did you check the status code returned by NtWriteFile?  Not all non-0
  status codes fail the !NT_SUCCESS (status) test.

- Do you have a simple, self-contained testcase?


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]