mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Boaz Harrosh <boaz@plexistor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Christoph Hellwig <hch@lst.de>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Linux API <linux-api@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	libc-alpha <libc-alpha@sourceware.org>
Subject: Re: RFC: reject unknown open flags
Date: Thu, 30 Mar 2017 23:05:59 +0300	[thread overview]
Message-ID: <6cbf0110-eb29-9b18-8f92-7ddf1d6c5cc2@plexistor.com> (raw)
In-Reply-To: <CA+55aFyhH0924xwS4q8sJ=F-HZyoSQZJaQ6cWgTCAj4PjrZt8g@mail.gmail.com>

On 03/30/2017 09:45 PM, Linus Torvalds wrote:
> On Thu, Mar 30, 2017 at 11:26 AM, Christoph Hellwig <hch@lst.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.
> 

Perhaps in that case it is time for an F_GETFL2 an F_GET_REAL_FL
that gives you the nice simple user code Linus wanted for new applications.
and solves forward and backwords for applications and Kernels?

Just my $0.017
Boaz

>                     Linus
> 

  reply	other threads:[~2017-03-30 20:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 16:33 Christoph Hellwig
2017-03-30 16:33 ` [PATCH 1/2] fs: add a VALID_OPEN_FLAGS Christoph Hellwig
2017-03-30 16:33 ` [PATCH 2/2] fs: reject unknown open flags Christoph Hellwig
2017-03-30 17:03   ` Linus Torvalds
2017-03-30 17:08 ` RFC: " Linus Torvalds
2017-03-30 17:21   ` Christoph Hellwig
2017-03-30 18:19     ` Linus Torvalds
2017-03-30 18:26       ` Christoph Hellwig
2017-03-30 18:45         ` Linus Torvalds
2017-03-30 20:05           ` Boaz Harrosh [this message]
2017-03-30 19:02       ` Paul Eggert
2017-03-30 19:14         ` Linus Torvalds
2017-03-30 19:22   ` Florian Weimer

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=6cbf0110-eb29-9b18-8f92-7ddf1d6c5cc2@plexistor.com \
    --to=boaz@plexistor.com \
    --cc=hch@lst.de \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®