Whamcloud - gitweb
LU-8585 llite: don't cache MDS_OPEN_LOCK for volatile files 41/36641/4
authorJames Simmons <jsimmons@infradead.org>
Wed, 6 Nov 2019 15:04:13 +0000 (10:04 -0500)
committerOleg Drokin <green@whamcloud.com>
Mon, 16 Dec 2019 05:58:45 +0000 (05:58 +0000)
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 <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/36641
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-by: Quentin Bouget <quentin.bouget@cea.fr>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/file.c

index 3b2ed89..7843c75 100644 (file)
@@ -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);