9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Giacomo Tesio <giacomo@tesio.it>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] create/create race
Date: Wed, 30 Nov 2016 16:02:56 +0100	[thread overview]
Message-ID: <CAHL7psHSnFp2df0dcVLcd_5OMHA4mm3rJWckRiqTTHSxE7T-BA@mail.gmail.com> (raw)
In-Reply-To: <CAOw7k5i+Jwb2CvwdzQY_sTpHyDXu0MGHnh33HEnSD41i8ZjpZQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1791 bytes --]

David it seem you walked my road already... :-)

I'm actually on a research project, so I do not care too much about the
issues on existing programs. I'm going to change/break them anyway.
Also, as far as I can foresee, it should be viable to fix such programs in
a partially automated way (eg via sed and a new "ocreate" library function
that mimic the current behaviour).

But reading that thread I can't actually see why the OEXCL path has been
taken instead of eliminating the race mapping the syscall to the 9p message.
I mean except backward compatibility.

Maybe it was found a performance issue in some more common use case?
Or a worse race prevented by the current semantic?


For example I've found pretty cryptic this message from David:
http://marc.info/?l=9fans&m=111558704718797&w=2

I'm surprised I haven't yet seen "What about union directories?"
>
> If create(2) is changed then it could succeed even though a
> file with that name exists in the union.  Then the above:
>
> if ((fd = create(file, mode, perm)) < 0) {
> 	error...
> }
>
> Would need to become:
>
> if ((fd = open(file, mode|OTRUNC)) < 0 ||
>     (fd = create(file, mode, perm)) < 0 ||
>     (fd = open(file, mode|OTRUNC)) < 0 ||
> 	error...
> }
>
> This is precisely the current create(2) call and the nasty
> race is clear.
>
>
Why the initial open() would be needed if create(2) always send a Tcreate?


Giacomo


2016-11-30 14:53 GMT+01:00 Charles Forsyth <charles.forsyth@gmail.com>:

>
> On 30 November 2016 at 13:32, <cinap_lenrek@felloff.net> wrote:
>
>> interesting, the thread starts here:
>>
>> http://marc.info/?l=9fans&m=111558704718788&w=2
>>
>
>
> I suspect the discussion predated 9P2000 and the introduction of the OEXCL
> option.
>

[-- Attachment #2: Type: text/html, Size: 3372 bytes --]

  reply	other threads:[~2016-11-30 15:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-24 21:25 Giacomo Tesio
2016-11-30 11:04 ` Giacomo Tesio
2016-11-30 11:19   ` cinap_lenrek
2016-11-30 13:14   ` G. David Butler
2016-11-30 13:32     ` cinap_lenrek
2016-11-30 13:53       ` Charles Forsyth
2016-11-30 15:02         ` Giacomo Tesio [this message]
2016-11-30 15:08           ` Charles Forsyth
2016-11-30 15:28             ` Giacomo Tesio
2016-11-30 15:34               ` Charles Forsyth
2016-11-30 15:40               ` cinap_lenrek
2016-11-30 16:16                 ` Giacomo Tesio
2016-11-30 21:51                   ` Charles Forsyth
2016-11-30 21:53                     ` Charles Forsyth
2016-11-30 23:15                       ` Giacomo Tesio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHL7psHSnFp2df0dcVLcd_5OMHA4mm3rJWckRiqTTHSxE7T-BA@mail.gmail.com \
    --to=giacomo@tesio.it \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).