From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752579AbcFTCLu (ORCPT ); Sun, 19 Jun 2016 22:11:50 -0400 Received: from linuxhacker.ru ([217.76.32.60]:56164 "EHLO fiona.linuxhacker.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752093AbcFTCJa (ORCPT ); Sun, 19 Jun 2016 22:09:30 -0400 From: Oleg Drokin To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger Cc: Linux Kernel Mailing List , Lustre Development List , Oleg Drokin , Oleg Drokin Subject: [PATCH 24/28] staging/lustre/llite: ll_revalidate_dentry update Date: Sun, 19 Jun 2016 22:07:39 -0400 Message-Id: <1466388463-1817551-25-git-send-email-green@linuxhacker.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1466388463-1817551-1-git-send-email-green@linuxhacker.ru> References: <1466388463-1817551-1-git-send-email-green@linuxhacker.ru> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oleg Drokin There are a couple of cases in ll_revalidate_dentry() where we are pretty sure the dentry is valid, so check for them early and save more expensive checks for later. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/dcache.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index d964f4f..581a63a 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -302,6 +302,17 @@ static int ll_revalidate_dentry(struct dentry *dentry, { struct inode *dir = d_inode(dentry->d_parent); + /* If this is intermediate component path lookup and we were able to get + * to this dentry, then its lock has not been revoked and the + * path component is valid. + */ + if (lookup_flags & LOOKUP_PARENT) + return 1; + + /* Symlink - always valid as long as the dentry was found */ + if (dentry->d_inode && S_ISLNK(dentry->d_inode->i_mode)) + return 1; + /* * if open&create is set, talk to MDS to make sure file is created if * necessary, because we can't do this in ->open() later since that's -- 2.7.4