All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Blunck <jblunck@suse.de>
To: linux-fsdevel@vger.kernel.org
Subject: Re: [RFC PATCH] mountinfo: show only reachable mounts
Date: Wed, 12 Mar 2008 13:20:08 +0000 (UTC)	[thread overview]
Message-ID: <fr8la8$si7$1@ger.gmane.org> (raw)
In-Reply-To: E1JZ7AX-0003SU-4A@pomaz-ex.szeredi.hu

On Tue, 11 Mar 2008 17:17:37 +0100, Miklos Szeredi wrote:

> +/*
> + * Return true if 'path' is reachable from 'root' + */
> +static bool is_path_reachable(const struct path *path, const struct
> path *root) +{
> +	struct dentry *dentry = path->dentry; +	struct vfsmount *mnt =
> path->mnt;
> +	bool res = false;
> +
> +	spin_lock(&dcache_lock);
> +	for (;;) {
> +		if (dentry == root->dentry && mnt == root->mnt) 
{ +			res = true;
> +			break;
> +		}
> +		if (dentry == mnt->mnt_root || IS_ROOT(dentry)) 
{ +			/* Global root?
> */
> +			spin_lock(&vfsmount_lock);
> +			if (mnt->mnt_parent == mnt) {
> +				spin_unlock(&vfsmount_lock);
> +				break;
> +			}
> +			dentry = mnt->mnt_mountpoint;
> +			mnt = mnt->mnt_parent;
> +			spin_unlock(&vfsmount_lock);
> +			continue;
> +		}
> +		dentry = dentry->d_parent;
> +	}
> +	spin_unlock(&dcache_lock);
> +
> +	return res;
> +}
> +

Hmm, this may hold dcache_lock for some time. Isn't it enough to use 
rcu_readlock() and read_seqbegin(&rename_lock) ?

Cheers,
Jan


  reply	other threads:[~2008-03-12 13:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-11 16:17 [RFC PATCH] mountinfo: show only reachable mounts Miklos Szeredi
2008-03-12 13:20 ` Jan Blunck [this message]
2008-03-12 18:11   ` Miklos Szeredi
2008-03-13 14:32     ` Miklos Szeredi
2008-03-14 15:17       ` Jan Blunck
2008-03-12 18:31 ` Ram Pai
2008-03-12 18:44   ` Miklos Szeredi

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='fr8la8$si7$1@ger.gmane.org' \
    --to=jblunck@suse.de \
    --cc=linux-fsdevel@vger.kernel.org \
    /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 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.