Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1288071

Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode

From Al Viro <viro@ZenIV.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode
Date 2015-12-10 01:20 +0100
Message-ID <qDX7I-73a-7@gated-at.bofh.it> (permalink)
References <qvXoe-2MS-5@gated-at.bofh.it> <qDFDP-485-3@gated-at.bofh.it> <qDQIW-2Tz-25@gated-at.bofh.it> <qDRF0-3u6-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Dec 09, 2015 at 06:23:09PM +0000, Al Viro wrote:

> What's more, that dentry might very well have gone negative by that
> point.  Think what happens if, during the symlink traversal, we run
> into the hard "restart from scratch in non-RCU mode".  We'll need to
> do ->put_link() on everything we have in stack.  Regardless of what
> might've happened to dentries/inodes of symlinks involved - all we
> are really promised is that RCU-delayed parts of their destruction hadn't
> been entered yet.
> 
> Note, BTW, that *all* ->put_link() instances ignore the inode argument
> and I seriously considered dropping it completely.

PS: I toyed with the idea of replacing cookie a struct callback_head, to make
it really obvious what's going on - we are leaving a closure to be evaluated
once the caller is done with our return value.  That way ->put_link() as a
method would've been gone and we would've had something like
	init_callback(destructor, page_put_link, page);
instead of
	*cookie = page;
plus
	.put_link = page_put_link,
we have right now, etc.

The reason not to go that way (and not all that strong, at that) is that
we get an extra pointer in struct saved, i.e. slightly heavier nameidata
(there are two struct saved embedded into it).  That, or play silly buggers
with
	union {
		struct callback_head callback;
		struct inode *inode;
	};
in struct saved - we need to stash a pointer to inode between pick_link()
and get_link().

Hell knows, still might make sense to go there...  What we want is to set
a closure to be evaluated once the caller of ->get_link() is done with
the string ->get_link() returns.  We end up picking the function to be
called at saved->inode->i_op->put_link and store its argument in
saved->cookie.  Might as well just use the representation we use for such
stuff (rcu_head, etc.) and be done with that...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 02/11] logfs: don't duplicate page_symlink_inode_operations Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 08/11] teach page_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 10/11] teach proc_self_get_link()/proc_thread_self_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 11/11] teach nfs_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 06/11] don't put symlink bodies in pagecache into highmem Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 01/11] switch befs long symlinks to page_symlink_operations Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 03/11] udf: don't duplicate page_symlink_inode_operations Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 09/11] teach shmem_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 04/11] ufs: get rid of ->setattr() for symlinks Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Linus Torvalds <torvalds@linux-foundation.org> - 2015-12-09 18:30 +0100
    Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 19:30 +0100
      Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-10 01:20 +0100
        Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-10 03:50 +0100
          Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-12-11 08:50 +0100
  Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode NeilBrown <neilb@suse.com> - 2015-12-09 23:00 +0100

csiph-web