linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: elementary d_move question
@ 2013-10-23 17:27 J. Bruce Fields
  0 siblings, 0 replies; 3+ messages in thread
From: J. Bruce Fields @ 2013-10-23 17:27 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel

(Bah, apologies, I messed up the list cc.  Resending in case it's useful
to have the answer in the archives.)

On Wed, Oct 23, 2013 at 01:23:38PM -0400, J. Bruce Fields wrote:
> On Wed, Oct 23, 2013 at 05:14:02PM +0100, Al Viro wrote:
> > On Wed, Oct 23, 2013 at 11:43:41AM -0400, J. Bruce Fields wrote:
> > 
> > > 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);
> > 
> > Yes
> > 
> > > giving target name "foo"
> > 
> > Not really.  Check what it does when both names are inline ones (i.e.
> > shorter than 32 characters and stored in struct dentry itself)...
> 
> Doh--got it, thanks!
> 
> I have a feeling I've gotten lost here before.
> 
> I assume it's just never seemed worth the trouble to make the readlink
> string more consistent given that its value's not really well-defined
> anyway, OK.
> 
> --b.

^ permalink raw reply	[flat|nested] 3+ messages in thread
* elementary d_move question
@ 2013-10-23 15:46 J. Bruce Fields
  2013-10-29 16:28 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: J. Bruce Fields @ 2013-10-23 15:46 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-29 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-23 17:27 elementary d_move question J. Bruce Fields
  -- strict thread matches above, loose matches on Subject: below --
2013-10-23 15:46 J. Bruce Fields
2013-10-29 16:28 ` Jan Kara

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).