Safeguards against incorrect fd flags for fsync()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Safeguards against incorrect fd flags for fsync()
Date: 2019-10-09 06:26:40
Message-ID: 20191009062640.GB21379@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
fsync-safeguards.patch text/x-diff 1.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2019-10-09 06:39:00 Re: [HACKERS] Deadlock in XLogInsert at AIX
Previous Message Moon, Insung 2019-10-09 06:20:35 Re: Transparent Data Encryption (TDE) and encrypted files