RE: client caching and locks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I don't think that case adds anything interesting.  When the file is
> closed, the lock is dropped.  If there were any writes without a
> delegation, then the changeid isn't a reliable indication that no other
> client wrote.  So the cache must be dropped.

I've understood it. 

I've made the patch based on your idea. It invalidates the cache
after a client without write-delegation sends CLOSE call.
My Open MPI test program confirmed that this fix resolves the problem.

The patch is as follows. What do you think?
-----
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index b18f31b2c9e7..67021786034d 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3711,7 +3711,8 @@ static const struct rpc_call_ops nfs4_close_ops = {
  */
 int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait)
 {
-       struct nfs_server *server = NFS_SERVER(state->inode);
+       struct inode *inode = state->inode;
+       struct nfs_server *server = NFS_SERVER(inode);
        struct nfs_seqid *(*alloc_seqid)(struct nfs_seqid_counter *, gfp_t);
        struct nfs4_closedata *calldata;
        struct nfs4_state_owner *sp = state->owner;
@@ -3773,6 +3774,15 @@ int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait)
        status = 0;
        if (wait)
                status = rpc_wait_for_completion_task(task);
+
+       if (status >= 0 && !NFS_PROTO(inode)->have_delegation(inode, FMODE_WRITE)) {
+               nfs_set_cache_invalid(inode, NFS_INO_INVALID_ATTR
+                                       | NFS_INO_INVALID_DATA
+                                       | NFS_INO_INVALID_ACCESS
+                                       | NFS_INO_INVALID_ACL
+                                       | NFS_INO_REVAL_PAGECACHE);
+       }
+
        rpc_put_task(task);
        return status;
 out_free_calldata:
-----

Yuki Inoguchi




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux