[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFyhH0924xwS4q8sJ=F-HZyoSQZJaQ6cWgTCAj4PjrZt8g@mail.gmail.com>
Date: Thu, 30 Mar 2017 11:45:32 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Christoph Hellwig <hch@....de>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Linux API <linux-api@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
libc-alpha <libc-alpha@...rceware.org>
Subject: Re: RFC: reject unknown open flags
On Thu, Mar 30, 2017 at 11:26 AM, Christoph Hellwig <hch@....de> wrote:
>
> That would be nice, but still won't work as we blindly copy f_flags
> into F_GETFL, not even masking our internal FMODE_ bits.
Ok, *that* is just silly of us, and we could try to just fix, and even backport.
There's no possible valid use I could see where that should break
(famous last words - user code does some damn odd things at times).
Of course, that won't fix old kernels that are out there, but then
neither would your original patch...
Side note: I think you *can* detect the O_ATOMIC support by using
F_SETFL, because F_SETFL only allows you to change flags that we
recognize. So somebody who really wants to *guarantee* that O_ATOMIC
is there and honored even with old kernels could presumable do
something like
fd = open(..); // *no* O_ATOMIC
fcnt(fd, F_SETFL, O_ATOMIC);
if (fcnt(fd, F_GETFL, NULL) & O_ATOMIC)
// Yay! We actually got it
else
// I guess we need to fall back on old behavior
although I agree that that is ridiculously inconvenient and not a
great thing, and it's worth trying to aim for some better model.
Linus
Powered by blists - more mailing lists