Whamcloud - gitweb
EX-3636 pcc: set invalid cache state for fallback I/O
authorQian Yingjin <qian@ddn.com>
Tue, 31 Aug 2021 09:11:42 +0000 (17:11 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Wed, 1 Sep 2021 15:30:33 +0000 (15:30 +0000)
When fallback I/O to Lustre (not PCC backend), it should set the
cache state correctly (with *cached = false).

Fixes: c3cf63c830 ("EX-3636 pcc: reset file mmaping for the file once mmaped")
Signed-off-by: Qian Yingjin <qian@ddn.com>
Change-Id: I4e7dad93c589ac8062fe6c08423bf209f08432b6
Reviewed-on: https://review.whamcloud.com/44793
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/llite/pcc.c

index 4fe7b34..f3e68e4 100644 (file)
@@ -2859,10 +2859,9 @@ int pcc_file_mmap(struct file *file, struct vm_area_struct *vma,
 
        ENTRY;
 
-       if (!pcc_file || !file_inode(pcc_file)->i_fop->mmap) {
-               *cached = false;
+       *cached = false;
+       if (!pcc_file || !file_inode(pcc_file)->i_fop->mmap)
                RETURN(0);
-       }
 
        pcc_inode_lock(inode);
        pcci = ll_i2pcci(inode);
@@ -2925,12 +2924,9 @@ int pcc_file_mmap(struct file *file, struct vm_area_struct *vma,
                       PFID(ll_inode2fid(inode)), vma, i_size_read(inode),
                       vma->vm_end - vma->vm_start, vma->vm_pgoff,
                       vma->vm_flags);
-       } else {
-               *cached = false;
        }
 out:
        pcc_inode_unlock(inode);
-
        RETURN(rc);
 }