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


Groups > linux.kernel > #1510024 > unrolled thread

Re: [PATCH 6/8] autofs - use path_is_mountpoint() to fix unreliable d_mountpoint() checks

Started byAl Viro <viro@ZenIV.linux.org.uk>
First post2016-10-27 04:20 +0200
Last post2016-10-27 05:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 6/8] autofs - use path_is_mountpoint() to fix unreliable  d_mountpoint() checks Al Viro <viro@ZenIV.linux.org.uk> - 2016-10-27 04:20 +0200
    Re: [PATCH 6/8] autofs - use path_is_mountpoint() to fix unreliable  d_mountpoint() checks Ian Kent <raven@themaw.net> - 2016-10-27 05:00 +0200

#1510024 — Re: [PATCH 6/8] autofs - use path_is_mountpoint() to fix unreliable d_mountpoint() checks

FromAl Viro <viro@ZenIV.linux.org.uk>
Date2016-10-27 04:20 +0200
SubjectRe: [PATCH 6/8] autofs - use path_is_mountpoint() to fix unreliable d_mountpoint() checks
Message-ID<swIsp-41y-3@gated-at.bofh.it>
On Tue, Oct 11, 2016 at 01:34:18PM +0800, Ian Kent wrote:
> +	path = file->f_path;
> +
>  	/*
>  	 * An empty directory in an autofs file system is always a
>  	 * mount point. The daemon must have failed to mount this
> @@ -123,7 +126,7 @@ static int autofs4_dir_open(struct inode *inode, struct file *file)
>  	 * it.
>  	 */
>  	spin_lock(&sbi->lookup_lock);
> -	if (!d_mountpoint(dentry) && simple_empty(dentry)) {
> +	if (!path_is_mountpoint(&path) && simple_empty(dentry)) {

Why not &file->f_path, provided that you constify that thing properly?

> +		if (rcu_walk) {
> +			if (!path_is_mountpoint_rcu(path))
> +				return -EISDIR;
> +		} else {
> +			if (!path_is_mountpoint(path))
> +				return -EISDIR;

IDGI.  What's the point of _having_ the _rcu() variant, anyway?  Here you
are probably paying more in terms of i-cache footprint/branch prediction
than you win on not doing that rcu_read_lock()/rcu_read_unlock()...

_rcu variants make sense when non-RCU case does something you can't do
under RCU; here your path_is_mountpoint() is pretty close to being
rcu_read_lock()+path_is_mountpoint_rcu()+rcu_read_unlock() anyway...

[toc] | [next] | [standalone]


#1510032

FromIan Kent <raven@themaw.net>
Date2016-10-27 05:00 +0200
Message-ID<swJ57-4eE-11@gated-at.bofh.it>
In reply to#1510024
On Thu, 2016-10-27 at 03:17 +0100, Al Viro wrote:
> On Tue, Oct 11, 2016 at 01:34:18PM +0800, Ian Kent wrote:
> > 
> > +	path = file->f_path;
> > +
> >  	/*
> >  	 * An empty directory in an autofs file system is always a
> >  	 * mount point. The daemon must have failed to mount this
> > @@ -123,7 +126,7 @@ static int autofs4_dir_open(struct inode *inode, struct
> > file *file)
> >  	 * it.
> >  	 */
> >  	spin_lock(&sbi->lookup_lock);
> > -	if (!d_mountpoint(dentry) && simple_empty(dentry)) {
> > +	if (!path_is_mountpoint(&path) && simple_empty(dentry)) {
> Why not &file->f_path, provided that you constify that thing properly?

Yep, my bad, as pointed out by Eric.

Patches to fix that and constify a bunch of things will follow.

> 
> > 
> > +		if (rcu_walk) {
> > +			if (!path_is_mountpoint_rcu(path))
> > +				return -EISDIR;
> > +		} else {
> > +			if (!path_is_mountpoint(path))
> > +				return -EISDIR;
> IDGI.  What's the point of _having_ the _rcu() variant, anyway?  Here you
> are probably paying more in terms of i-cache footprint/branch prediction
> than you win on not doing that rcu_read_lock()/rcu_read_unlock()...
> 
> _rcu variants make sense when non-RCU case does something you can't do
> under RCU; here your path_is_mountpoint() is pretty close to being
> rcu_read_lock()+path_is_mountpoint_rcu()+rcu_read_unlock() anyway...

Again, my bad, I'll merge these two and post along with the follow up patches
above.

Thanks Al,
Ian

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web