Safeguards against incorrect fd flags for fsync() - Mailing list pgsql-hackers

From Michael Paquier
Subject Safeguards against incorrect fd flags for fsync()
Date
Msg-id 20191009062640.GB21379@paquier.xyz
Whole thread Raw
Responses Re: Safeguards against incorrect fd flags for fsync()
List pgsql-hackers
Hi all,

After the set of issues discussed here, it seems to me that it would
be a good thing to have some safeguards against incorrect flags when
opening a fd which would be used for fsync():
https://www.postgresql.org/message-id/16039-196fc97cc05e141c@postgresql.org

Attached is a patch aimed at doing that.  Historically O_RDONLY is 0,
so when looking at a directory we just need to make sure that no write
flags are used.  For files, that's the contrary, a write flag has to
be used.

Thoughts or better ideas?

Thanks,
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: "Moon, Insung"
Date:
Subject: Re: Transparent Data Encryption (TDE) and encrypted files
Next
From: Noah Misch
Date:
Subject: Re: [HACKERS] Deadlock in XLogInsert at AIX