Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34810
b: refs/heads/master
c: 5f004cf
h: refs/heads/master
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Sep 23, 2006
1 parent 6fd43dc commit 06fd3d3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2dec51466a08ac1c67da41bfd0518d43d983a2eb
refs/heads/master: 5f004cf2aa8494708fd8d78e78142b7b2748e765
19 changes: 16 additions & 3 deletions trunk/fs/nfs/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,13 @@ int nfs_readpage_result(struct rpc_task *task, struct nfs_read_data *data)

nfs_add_stats(data->inode, NFSIOS_SERVERREADBYTES, resp->count);

/* Is this a short read? */
if (task->tk_status >= 0 && resp->count < argp->count && !resp->eof) {
if (task->tk_status < 0) {
if (task->tk_status == -ESTALE) {
set_bit(NFS_INO_STALE, &NFS_FLAGS(data->inode));
nfs_mark_for_revalidate(data->inode);
}
} else if (resp->count < argp->count && !resp->eof) {
/* This is a short read! */
nfs_inc_stats(data->inode, NFSIOS_SHORTREAD);
/* Has the server at least made some progress? */
if (resp->count != 0) {
Expand Down Expand Up @@ -616,6 +621,10 @@ int nfs_readpage(struct file *file, struct page *page)
if (error)
goto out_error;

error = -ESTALE;
if (NFS_STALE(inode))
goto out_error;

if (file == NULL) {
ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
if (ctx == NULL)
Expand Down Expand Up @@ -678,14 +687,17 @@ int nfs_readpages(struct file *filp, struct address_space *mapping,
};
struct inode *inode = mapping->host;
struct nfs_server *server = NFS_SERVER(inode);
int ret;
int ret = -ESTALE;

dprintk("NFS: nfs_readpages (%s/%Ld %d)\n",
inode->i_sb->s_id,
(long long)NFS_FILEID(inode),
nr_pages);
nfs_inc_stats(inode, NFSIOS_VFSREADPAGES);

if (NFS_STALE(inode))
goto out;

if (filp == NULL) {
desc.ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
if (desc.ctx == NULL)
Expand All @@ -701,6 +713,7 @@ int nfs_readpages(struct file *filp, struct address_space *mapping,
ret = err;
}
put_nfs_open_context(desc.ctx);
out:
return ret;
}

Expand Down

0 comments on commit 06fd3d3

Please sign in to comment.