From: James Simmons Date: Wed, 6 Nov 2019 15:04:13 +0000 (-0500) Subject: LU-8585 llite: don't cache MDS_OPEN_LOCK for volatile files X-Git-Tag: 2.13.51~87 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=6a3a842add0e941d901869db195ec0068e69cde3 LU-8585 llite: don't cache MDS_OPEN_LOCK for volatile files 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. Change-Id: Ia5d78baf17279c6f268bc0bf443b428d5cbea440 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/36641 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Shaun Tancheff Reviewed-by: Quentin Bouget Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 3b2ed89..7843c75 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -787,7 +787,9 @@ restart: } else { LASSERT(*och_usecount == 0); if (!it->it_disposition) { - struct ll_dentry_data *ldd = ll_d2d(file->f_path.dentry); + struct dentry *dentry = file_dentry(file); + struct ll_dentry_data *ldd; + /* We cannot just request lock handle now, new ELC code means that one of other OPEN locks for this file could be cancelled, and since blocking ast handler @@ -809,18 +811,21 @@ restart: * lookup path only, since ll_iget_for_nfs always calls * ll_d_init(). */ + 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; } - /* + /* * Always specify MDS_OPEN_BY_FID because we don't want * to get file with different fid. */ it->it_flags |= MDS_OPEN_BY_FID; - rc = ll_intent_file_open(file_dentry(file), NULL, 0, - it); + rc = ll_intent_file_open(dentry, NULL, 0, it); if (rc) GOTO(out_openerr, rc);