aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-09-15 18:26:05 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2016-09-27 14:35:36 -0400
commitbfc505ded01e3c57d12c6f939f352200655d8635 (patch)
tree0f830bf3f57aa443692ea062a5c642c086e410dd
parent77b00bc037e7c58d7a4ef791d1c7eeaf6f7a43e3 (diff)
pNFS: Fix atime updates on pNFS clients
Fix the code so that we always mark the atime as invalid in nfs4_read_done(). Currently, the expectation appears to be that the pNFS drivers should always do this, with the result that most of them don't. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r--fs/nfs/internal.h1
-rw-r--r--fs/nfs/nfs4proc.c8
-rw-r--r--fs/nfs/pnfs.c4
3 files changed, 3 insertions, 10 deletions
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 4f0b2db8327f..512b776824c9 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -560,7 +560,6 @@ void nfs_init_cinfo_from_dreq(struct nfs_commit_info *cinfo,
560extern ssize_t nfs_dreq_bytes_left(struct nfs_direct_req *dreq); 560extern ssize_t nfs_dreq_bytes_left(struct nfs_direct_req *dreq);
561 561
562/* nfs4proc.c */ 562/* nfs4proc.c */
563extern void __nfs4_read_done_cb(struct nfs_pgio_header *);
564extern struct nfs_client *nfs4_init_client(struct nfs_client *clp, 563extern struct nfs_client *nfs4_init_client(struct nfs_client *clp,
565 const struct nfs_client_initdata *); 564 const struct nfs_client_initdata *);
566extern int nfs40_walk_client_list(struct nfs_client *clp, 565extern int nfs40_walk_client_list(struct nfs_client *clp,
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 27120baf1ff3..5b2b07bca490 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4557,11 +4557,6 @@ static bool nfs4_error_stateid_expired(int err)
4557 return false; 4557 return false;
4558} 4558}
4559 4559
4560void __nfs4_read_done_cb(struct nfs_pgio_header *hdr)
4561{
4562 nfs_invalidate_atime(hdr->inode);
4563}
4564
4565static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_pgio_header *hdr) 4560static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_pgio_header *hdr)
4566{ 4561{
4567 struct nfs_server *server = NFS_SERVER(hdr->inode); 4562 struct nfs_server *server = NFS_SERVER(hdr->inode);
@@ -4581,7 +4576,6 @@ static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_pgio_header *hdr)
4581 } 4576 }
4582 } 4577 }
4583 4578
4584 __nfs4_read_done_cb(hdr);
4585 if (task->tk_status > 0) 4579 if (task->tk_status > 0)
4586 renew_lease(server, hdr->timestamp); 4580 renew_lease(server, hdr->timestamp);
4587 return 0; 4581 return 0;
@@ -4610,6 +4604,8 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_pgio_header *hdr)
4610 return -EAGAIN; 4604 return -EAGAIN;
4611 if (nfs4_read_stateid_changed(task, &hdr->args)) 4605 if (nfs4_read_stateid_changed(task, &hdr->args))
4612 return -EAGAIN; 4606 return -EAGAIN;
4607 if (task->tk_status > 0)
4608 nfs_invalidate_atime(hdr->inode);
4613 return hdr->pgio_done_cb ? hdr->pgio_done_cb(task, hdr) : 4609 return hdr->pgio_done_cb ? hdr->pgio_done_cb(task, hdr) :
4614 nfs4_read_done_cb(task, hdr); 4610 nfs4_read_done_cb(task, hdr);
4615} 4611}
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index b588ccf05045..56b2d96f9103 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -2230,10 +2230,8 @@ static void pnfs_ld_handle_read_error(struct nfs_pgio_header *hdr)
2230 */ 2230 */
2231void pnfs_ld_read_done(struct nfs_pgio_header *hdr) 2231void pnfs_ld_read_done(struct nfs_pgio_header *hdr)
2232{ 2232{
2233 if (likely(!hdr->pnfs_error)) { 2233 if (likely(!hdr->pnfs_error))
2234 __nfs4_read_done_cb(hdr);
2235 hdr->mds_ops->rpc_call_done(&hdr->task, hdr); 2234 hdr->mds_ops->rpc_call_done(&hdr->task, hdr);
2236 }
2237 trace_nfs4_pnfs_read(hdr, hdr->pnfs_error); 2235 trace_nfs4_pnfs_read(hdr, hdr->pnfs_error);
2238 if (unlikely(hdr->pnfs_error)) 2236 if (unlikely(hdr->pnfs_error))
2239 pnfs_ld_handle_read_error(hdr); 2237 pnfs_ld_handle_read_error(hdr);