Re: potential stuck lock in SaveSlotToPath() - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: potential stuck lock in SaveSlotToPath()
Date
Msg-id 20200327074845.GD1486@paquier.xyz
Whole thread Raw
In response to Re: potential stuck lock in SaveSlotToPath()  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Responses Re: potential stuck lock in SaveSlotToPath()  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
On Thu, Mar 26, 2020 at 02:16:05PM +0100, Peter Eisentraut wrote:
> committed and backpatched

The patch committed does that in three places:
    /* rename to permanent file, fsync file and directory */
    if (rename(tmppath, path) != 0)
    {
+       LWLockRelease(&slot->io_in_progress_lock);
    ereport(elevel,
                (errcode_for_file_access(),
                 errmsg("could not rename file \"%s\" to \"%s\": %m",

But why do you assume that LWLockRelease() never changes errno?  It
seems to me that you should save errno before calling LWLockRelease(),
and then restore it back before using %m in the log message, no?  See
for example the case where trace_lwlocks is set.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_checksums in backend/storage/page/README
Next
From: Masahiko Sawada
Date:
Subject: Re: error context for vacuum to include block number