Re: fix pg_mkdir_p to tolerate concurrent directory creation - Mailing list pgsql-hackers

From Tom Lane
Subject Re: fix pg_mkdir_p to tolerate concurrent directory creation
Date
Msg-id 1231927.1781792643@sss.pgh.pa.us
Whole thread
In response to fix pg_mkdir_p to tolerate concurrent directory creation  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: fix pg_mkdir_p to tolerate concurrent directory creation
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> While working on the pytest stuff, I found this issue when making it 
> work on Windows, but the issue can exist everywhere. pg_mkdir_p can fail 
> if there is a concurrent directory creation.

This bit:

+            if (errno != EEXIST || stat(path, &sb) != 0 || !S_ISDIR(sb.st_mode))
+            {
+                retval = -1;
+                break;
+            }

looks like it could corrupt the reported errno, ie stat() could
overwrite what mkdir() reported.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: pg_buffercache: Add per-relation summary stats
Next
From: Ashutosh Bapat
Date:
Subject: Re: GRAPH_TABLE: aggregates/window/set-returning functions in COLUMNS crash the backend