[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+55aFy5qCfbr59-7X-EwoS4FpbH65tjhzMdnzSQ3AW5TsRPWw@mail.gmail.com>
Date: Tue, 11 Feb 2014 09:54:17 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
linux-man@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: O_TMPFILE detection
On Tue, Feb 11, 2014 at 8:03 AM, Christoph Hellwig <hch@...radead.org> wrote:
> I've started implementing support for O_TMPFILE in xfs_io in preparation
> for proper testcases and found something rather annoying:
>
> Given that we implicitly pass O_DIRECTORY as part of the full O_TMPFILE
> flag an open using O_TMPFILE will simply succeed on a kernel old enough
> to not have O_TMPFILE support, and give you a file descriptor for the
> directory passed in. Of course this only works if you open the fd
> read-only which isn't all that useful for real temporary files, but it
> would be the natural choice for a feature test.
But O_TMPFILE without write access fails on modern kernels, so what
you test doesn't make sense.
In fact, that "O_TMPFILE fails with O_RDONLY" was done exactly so that
you could not have a program that works on kernels with O_TMPFILE
support _and_ opens a directory on old kernels without it. Basically
"O_TMPFILE | O_RDONLY" is an insane thing to do, and will never create
a temporary file.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists