NFSv3: Improve NFSv3 performance when server returns no post-op attributes
[sfrench/cifs-2.6.git] / fs / nfs / nfs3proc.c
index ec8a9efa268fec13f78daaf347b37a6b707d6f1e..71bc16225b9817ece6719a687c2c7c18d4ca81ef 100644 (file)
@@ -786,6 +786,7 @@ nfs3_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
 static int nfs3_read_done(struct rpc_task *task, struct nfs_pgio_header *hdr)
 {
        struct inode *inode = hdr->inode;
+       struct nfs_server *server = NFS_SERVER(inode);
 
        if (hdr->pgio_done_cb != NULL)
                return hdr->pgio_done_cb(task, hdr);
@@ -793,6 +794,9 @@ static int nfs3_read_done(struct rpc_task *task, struct nfs_pgio_header *hdr)
        if (nfs3_async_handle_jukebox(task, inode))
                return -EAGAIN;
 
+       if (task->tk_status >= 0 && !server->read_hdrsize)
+               cmpxchg(&server->read_hdrsize, 0, hdr->res.replen);
+
        nfs_invalidate_atime(inode);
        nfs_refresh_inode(inode, &hdr->fattr);
        return 0;
@@ -802,6 +806,7 @@ static void nfs3_proc_read_setup(struct nfs_pgio_header *hdr,
                                 struct rpc_message *msg)
 {
        msg->rpc_proc = &nfs3_procedures[NFS3PROC_READ];
+       hdr->args.replen = NFS_SERVER(hdr->inode)->read_hdrsize;
 }
 
 static int nfs3_proc_pgio_rpc_prepare(struct rpc_task *task,