Messages in this thread | | | Date | Mon, 3 Nov 2014 11:04:27 -0800 | Subject | Re: [RFC PATCH] fs: allow open(dir, O_TMPFILE|..., 0) with mode 0 | From | Linus Torvalds <> |
| |
On Mon, Nov 3, 2014 at 10:49 AM, Eric Rannaud <e@nanocritical.com> wrote: > > Isn't it because they are essentially emulating an atomic open() > capable of creating a file with inherited ACLs, according to > relatively complex rules? open *can* be used with O_CREAT|O_RDONLY > (touch(1) might do that), which would naively translate into:
Oh, so you don't actually need any file contents at all?
If that is actually a real usage, then maybe we should just say that "O_TMPFILE|O_RDONLY" is fine, and remove the check that it has to be writable.
That check was always a sanity-check, because people felt that a temp-file you can't write to is an insane concept. But if there is a real use case for it, then clearly it's not completely insane. Just odd.
It's just that single
if (!(acc_mode & MAY_WRITE)) return -EINVAL;
test in build_open_flags(), right?
I'd take a tested patch to remove that (where "tested" means: "yes, I actually did that unwritable file descriptor thing, and it actually solved the problem and worked for samba or whatever")
Linus
| |