Thread (1 message) 1 message, 1 author, 2021-03-11

Re: [RFC PATCH] merge-recursive: create new files with O_EXCL

From: Junio C Hamano <hidden>
Date: 2021-03-11 17:53:52

Ephrim Khong [off-list ref] writes:
quoted
I do not think we mind fixing the use of O_TRUNC with "remove and
then create with O_EXCL", but we'd probably want to

 * understand why only this place matters, or perhaps other uses of
   O_TRUNC needs the same fix to work "correctly" with your NFS
   mounts, in which case we'd need all of them addressed in the same
   series of patches, and
I'd say that is up to you. Personally I'd rather err on the side of
caution and leave the other code as is, especially since it is not
really required for the file mode issue as described above.
OK.

Especially the other places are prepared to deal with a leftover
stale file, there is no reason to add extra cost to unlink before
recreating.  If we know this place we will never have an existing
file (because we unlinked), then TRUNC -> EXCL is a no-cost change
for us.

If some of these other places turn out to be problem for you and
other users who are affected by the same NFS mount problem, we may
need to replace these places' open(CREAT|TRUNC) with a wrapper that
conditionally does an unlink+open(CREAT|EXCL) with a Makefile knob.

But before doing any of that, we'd need to see ...
quoted
 * understand why your NFS mount is broken and give a better
   explanation as to why we need to have a workaround in our code.
I'll work on this, but unfortunately have no idea of how to properly
debug it. Since it is a company server without administrative rights and
the backend is some IBM storage system, the options are limited and
processes are slow. What I did find out so far is that it is not a race
condition with unlink. A simple openat() without O_EXCL already produces
the wrong file mode.
... this resolved, I would think.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help