All of
 help / color / mirror / Atom feed
From: Al Viro <>
To: Linus Torvalds <>
Cc: Rasmus Villemoes <>,
	Linux Kernel Mailing List <>,
	linux-fsdevel <>
Subject: Re: [git pull] vfs.git part 2
Date: Fri, 12 Jul 2013 21:02:05 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Fri, Jul 12, 2013 at 12:42:15PM -0700, Linus Torvalds wrote:

> As to the mode argument: we should encourage people to have it, since
> the inode *may* become visible afterwards. See above (can you do
> linkat() to just turn an fd into a name? I didn't really check, but I
> think you can do it as a "link(/proc/sef/fd/..)" thing regardless).

link() won't do it, linkat() with the right arguments will (link(2)
doesn't follow symlinks on the oldname).  It's a bit more complicated,
	* vfs_link() will refuse to link with link count that went down to 0
(always had, and that's a damn good idea for security reasons)
	* with O_TMPFILE, vfs_link() will act as usual *if* you give open()
O_EXCL as well - files created that way cannot be linked in, ever.  They
stay with link count 0 and they die as soon as they are closed.  Again,
that's the behaviour we'd have with O_CREAT open + unlink.  tmpfile(3) ought
to call it that way.
	* O_TMPFILE _without_ O_EXCL == you may link it in once you've
decided that you've set it up enough.  In that case you are supposed to
open it, write whatever you want to write, fchmod/fchown/fsetxattr/etc.
and use linkat() to put it in place.  Or use vfs_link() if you are doing
that kernel-side.

  reply	other threads:[~2013-07-12 20:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-03 12:29 [git pull] vfs.git part 2 Al Viro
2013-07-11 21:42 ` Linus Torvalds
2013-07-12  5:48   ` Al Viro
2013-07-12 11:54     ` Al Viro
2013-07-12 12:02     ` Rasmus Villemoes
2013-07-12 15:48       ` Al Viro
2013-07-12 16:30         ` Rasmus Villemoes
2013-07-12 19:13           ` Al Viro
2013-07-12 19:39             ` Al Viro
2013-07-12 20:21               ` Linus Torvalds
2013-07-12 21:16                 ` Al Viro
2013-07-15 23:13                 ` Rasmus Villemoes
2013-07-12 19:42             ` Linus Torvalds
2013-07-12 20:02               ` Al Viro [this message]
2017-07-05  7:14 Al Viro

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \

* 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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.