potential stuck lock in SaveSlotToPath()

Peter Eisentraut <peter.eisentraut@2ndquadrant.com>

From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2020-03-18T15:46:23Z
Lists: pgsql-hackers

Attachments

When SaveSlotToPath() is called with elevel=LOG, the early exits don't 
release the slot's io_in_progress_lock.  Fix attached.

This could result in a walsender being stuck on the lock forever.  A 
possible way to get into this situation is if the offending code paths 
are triggered in a low disk space situation.  (This is how it was found; 
maybe there are other ways.)

Pavan Deolasee and Craig Ringer worked on this issue.  I'm forwarding it 
on their behalf.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Commits

  1. Drop slot's LWLock before returning from SaveSlotToPath()