/* Check if the dentry or any of it's aliases is acceptable.  */
static struct dentry* find_acceptable_alias(struct dentry *result, int(*acceptable)(void *context, struct dentry *dentry), void *context)
/* Check if the dentry or any of it's aliases is acceptable.  */
static struct dentry* find_acceptable_alias(struct dentry *result, int(*acceptable)(void *context, struct dentry *dentry), void *context)
{
	struct dentry *dentry, *toput = NULL;
	if (acceptable(context, result))
		return result;
	spin_lock(&dcache_lock);
	list_for_each_entry(dentry, &result->d_inode->i_dentry, d_alias) {
		dget_locked(dentry);
		spin_unlock(&dcache_lock);
		if (toput)
			dput(toput);
		if (dentry != result && acceptable(context, dentry)) {
			dput(result);
			return dentry;
		}
		spin_lock(&dcache_lock);
		toput = dentry;
	}
	spin_unlock(&dcache_lock);
	if (toput)
		dput(toput);
	return NULL;
}