提交 5c346854 编写于 作者: T Trond Myklebust

NFS: Assume eof if the server returns no readdir records

Some servers are known to be buggy w.r.t. this. Deal with them...
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 463a376e
...@@ -466,8 +466,9 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en ...@@ -466,8 +466,9 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
struct xdr_stream stream; struct xdr_stream stream;
struct xdr_buf buf; struct xdr_buf buf;
__be32 *ptr = xdr_page; __be32 *ptr = xdr_page;
int status;
struct nfs_cache_array *array; struct nfs_cache_array *array;
unsigned int count = 0;
int status;
buf.head->iov_base = xdr_page; buf.head->iov_base = xdr_page;
buf.head->iov_len = buflen; buf.head->iov_len = buflen;
...@@ -488,6 +489,8 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en ...@@ -488,6 +489,8 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
break; break;
} }
count++;
if (desc->plus == 1) if (desc->plus == 1)
nfs_prime_dcache(desc->file->f_path.dentry, entry); nfs_prime_dcache(desc->file->f_path.dentry, entry);
...@@ -496,13 +499,14 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en ...@@ -496,13 +499,14 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
break; break;
} while (!entry->eof); } while (!entry->eof);
if (status == -EBADCOOKIE && entry->eof) { if (count == 0 || (status == -EBADCOOKIE && entry->eof == 1)) {
array = nfs_readdir_get_array(page); array = nfs_readdir_get_array(page);
if (!IS_ERR(array)) { if (!IS_ERR(array)) {
array->eof_index = array->size; array->eof_index = array->size;
status = 0; status = 0;
nfs_readdir_release_array(page); nfs_readdir_release_array(page);
} } else
status = PTR_ERR(array);
} }
return status; return status;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册