lkml.org 
[lkml]   [2013]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [git pull] vfs.git part 2
From
On Fri, Jul 12, 2013 at 12:39 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> I mean something like this:
>
> Safer ABI for O_TMPFILE
>
> [suggested by Rasmus Villemoes] make O_DIRECTORY | O_RDWR part of O_TMPFILE;
> that will fail on old kernels in a lot more cases than what I came up with.

So see earlier about why I'm not convinced about O_RDWR. But even if
we really want that (and it might be better to start off too narrow
than accept anything else) your patch tests those bits the wrong way
(any O_RDWR test should be done using the O_ACCMODE mask, not using
the O_RDWR value itself as a mask)

Also, to make sure that the "no preexisting file" case fails, I still
think you should also verify that O_CREAT is not set. Otherwise
Rasmus' case

open("/tmp/test/link_to_nowhere", O_DIRECTORY | O_RDWR, 0666) ->
-1; No such file or directory

can work, and the case that rasmus didn't have at all (non-existent
pathname) also just silently succeeds by creating a file instead of
the expected directory..

So you could have something like

#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY | O_RDWR)
#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT | O_ACCMODE)

and then use

if ((flags & O_TMPFILE_MASK) != O_TMPFILE)
return -ENOTSUPP;

or whatever.

Hmm?

Linus


\
 
 \ /
  Last update: 2013-07-12 22:41    [W:0.055 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site