From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 2/8] NFS: Assume eof if the server returns no readdir records
Date: Sun, 21 Nov 2010 14:21:16 -0500 [thread overview]
Message-ID: <1290367282-5445-2-git-send-email-Trond.Myklebust@netapp.com> (raw)
In-Reply-To: <1290367282-5445-1-git-send-email-Trond.Myklebust@netapp.com>
Some servers are known to be buggy w.r.t. this. Deal with them...
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---
fs/nfs/dir.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 662df2a..2789cb3 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -466,8 +466,9 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
struct xdr_stream stream;
struct xdr_buf buf;
__be32 *ptr = xdr_page;
- int status;
struct nfs_cache_array *array;
+ unsigned int count = 0;
+ int status;
buf.head->iov_base = xdr_page;
buf.head->iov_len = buflen;
@@ -488,6 +489,8 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
break;
}
+ count++;
+
if (desc->plus == 1)
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
break;
} while (!entry->eof);
- if (status == -EBADCOOKIE && entry->eof) {
+ if (count == 0 || (status == -EBADCOOKIE && entry->eof == 1)) {
array = nfs_readdir_get_array(page);
if (!IS_ERR(array)) {
array->eof_index = array->size;
status = 0;
nfs_readdir_release_array(page);
- }
+ } else
+ status = PTR_ERR(array);
}
return status;
}
--
1.7.3.2
next prev parent reply other threads:[~2010-11-21 19:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-21 19:21 [PATCH 1/8] NFS: Buffer overflow in ->decode_dirent() should not be fatal Trond Myklebust
2010-11-21 19:21 ` Trond Myklebust [this message]
2010-11-21 19:21 ` [PATCH 3/8] NFS: Fix a page leak in nfs_do_filldir() Trond Myklebust
2010-11-21 19:21 ` [PATCH 4/8] NFS: Fix a page leak in uncached_readdir() Trond Myklebust
2010-11-21 19:21 ` [PATCH 5/8] NFS: Fix the error handling in "uncached_readdir()" Trond Myklebust
2010-11-21 19:21 ` [PATCH 6/8] NFS: Don't ignore errors from nfs_do_filldir() Trond Myklebust
2010-11-21 19:21 ` [PATCH 7/8] NFS: Correct the array bound calculation in nfs_readdir_add_to_array Trond Myklebust
2010-11-21 19:21 ` [PATCH 8/8] NFS: Ensure we return the dirent->d_type when it is known Trond Myklebust
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1290367282-5445-2-git-send-email-Trond.Myklebust@netapp.com \
--to=trond.myklebust@netapp.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).