Re: Permission denied on fsync / Win32 (was right

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Peter Brant" <Peter(dot)Brant(at)wicourts(dot)gov>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Permission denied on fsync / Win32 (was right
Date: 2006-04-18 19:00:54
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCEA0F91B@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> It happens often enough and the episodes last long enough
> that grabbing a handle dump while this is going on should be
> easily done.
>
> Regarding the Win32 error code, backend/storage/file/fd.c
> calls _commit().
> http://msdn2.microsoft.com/en-us/library/17618685(VS.80).aspx
> It looks
> like it is already using errno to report errors. Will
> GetLastError() return something useful there?

Good point.
Ran a quick test. If I open the file read-only and then fsync, I get
errno=9 (EBADF) and GetLastError()=5. Which explains the fact that we
got the wrong error-code. The *underlying API call* to _commit() returns
access denied...

Looking at the source to _commit(), if the call to FlushFileBuffers()
returns an error, it will set _doserrno to that value,and then return
with errno=EBADF.

So, this basicalliyu means that FlushFileBuffers() returns ACCESS
DENIED.

//Magnus

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-04-18 19:01:05 Re: [Win32] Problem with rename()
Previous Message Tom Lane 2006-04-18 18:53:57 Re: Permission denied on fsync / Win32 (was right