linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Subject: elementary d_move question
Date: Wed, 23 Oct 2013 11:46:54 -0400	[thread overview]
Message-ID: <20131023154654.GC30796@fieldses.org> (raw)

If I rename foo over bar, while holding bar open, then
/proc/<pid>/fd/<fd> still shows me bar's old path:

	$ touch foo bar
	$ tail -f bar &
	[1] 23492
	$ mv foo bar
	$ readlink /proc/23492/fd/3
	/home/bfields/bar (deleted)

The rename does a d_move(dentry, target) where I assume dentry is for
"foo" and target for "bar", with target the same dentry that the file
descriptor holds a reference on.

But d_move() does

	switch_names(dentry, target);

giving target name "foo".  So how does readlink still get "bar"?

I've clearly missed something obvious....

--b.

             reply	other threads:[~2013-10-23 15:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-23 15:46 J. Bruce Fields [this message]
2013-10-29 16:28 ` elementary d_move question Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2013-10-23 17:27 J. Bruce Fields

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=20131023154654.GC30796@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=linux-fsdevel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).