From patchwork Thu Feb 27 21:16:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410683 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1385924 for ; Thu, 27 Feb 2020 21:44:21 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C8ADE24690 for ; Thu, 27 Feb 2020 21:44:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C8ADE24690 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 7F4713489D7; Thu, 27 Feb 2020 13:35:30 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 0866F348938 for ; Thu, 27 Feb 2020 13:21:10 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id BE6E991C1; Thu, 27 Feb 2020 16:18:19 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id BCE2D46A; Thu, 27 Feb 2020 16:18:19 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:16:59 -0500 Message-Id: <1582838290-17243-552-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 551/622] lustre: llite: don't cache MDS_OPEN_LOCK for volatile files X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" The kernels knfsd constantly opens and closes files for each access which can result in a continuous stream of open+close RPCs being send to the MDS. To avoid this Lustre created a special flag, ll_nfs_dentry, which enables caching of the MDS_OPEN_LOCK on the client. The fhandles API also uses the same exportfs layer as NFS which indirectly ends up caching the MDS_OPEN_LOCK as well. This is okay for normal files except for Lustre's special volatile files that are used for HSM restore. It is expected on the last close of a Lustre volatile file that it is no longer accessable. To ensure this behavior is kept don't cache MDS_OPEN_LOCK for volatile files. WC-bug-id: https://jira.whamcloud.com/browse/LU-8585 Lustre-commit: 6a3a842add0e ("LU-8585 llite: don't cache MDS_OPEN_LOCK for volatile files") Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/36641 Reviewed-by: Andreas Dilger Reviewed-by: Shaun Tancheff Reviewed-by: Quentin Bouget Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/llite/file.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c index d196da8..a3c36a7 100644 --- a/fs/lustre/llite/file.c +++ b/fs/lustre/llite/file.c @@ -798,6 +798,7 @@ int ll_file_open(struct inode *inode, struct file *file) } else { LASSERT(*och_usecount == 0); if (!it->it_disposition) { + struct dentry *dentry = file_dentry(file); struct ll_dentry_data *ldd; /* We cannot just request lock handle now, new ELC code @@ -822,10 +823,13 @@ int ll_file_open(struct inode *inode, struct file *file) * lookup path only, since ll_iget_for_nfs always calls * ll_d_init(). */ - ldd = ll_d2d(file->f_path.dentry); + ldd = ll_d2d(dentry); if (ldd && ldd->lld_nfs_dentry) { ldd->lld_nfs_dentry = 0; - it->it_flags |= MDS_OPEN_LOCK; + if (!filename_is_volatile(dentry->d_name.name, + dentry->d_name.len, + NULL)) + it->it_flags |= MDS_OPEN_LOCK; } /* @@ -833,8 +837,7 @@ int ll_file_open(struct inode *inode, struct file *file) * to get file with different fid. */ it->it_flags |= MDS_OPEN_BY_FID; - rc = ll_intent_file_open(file->f_path.dentry, - NULL, 0, it); + rc = ll_intent_file_open(dentry, NULL, 0, it); if (rc) goto out_openerr;