Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 303356 Details for
Bug 443655
Clean up handling of short readdir packets in NFS client
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
clean up short packet handling for NFSv4 readdir
09-bz-428720-nfs-clean-up-short-p.patch (text/plain), 3.03 KB, created by
Jeff Layton
on 2008-04-22 18:31:03 UTC
(
hide
)
Description:
clean up short packet handling for NFSv4 readdir
Filename:
MIME Type:
Creator:
Jeff Layton
Created:
2008-04-22 18:31:03 UTC
Size:
3.03 KB
patch
obsolete
>BZ#428720: NFS: clean up short packet handling for NFSv4 readdir > >From: Jeff Layton <jlayton@redhat.com> > >Currently, the NFS readdir decoders have a workaround for buggy servers >that send an empty readdir response with the EOF bit unset. If the >server sends a malformed response in some cases, this workaround kicks >in and just returns an empty response rather than returning a proper >error to the caller. > >This patch does 3 things: > >1) have malformed responses with no entries return error (-EIO) > >2) preserve existing workaround for servers that send empty > responses with the EOF marker unset. > >3) Add some comments to clarify the logic in decode_readdir(). > >Signed-off-by: Jeff Layton <jlayton@redhat.com> >--- > > fs/nfs/nfs4xdr.c | 37 +++++++++++++++++++++++++++---------- > 1 files changed, 27 insertions(+), 10 deletions(-) > > >diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c >index e118ce1..b3d3121 100644 >--- a/fs/nfs/nfs4xdr.c >+++ b/fs/nfs/nfs4xdr.c >@@ -3035,7 +3035,7 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n > struct xdr_buf *rcvbuf = &req->rq_rcv_buf; > struct page *page = *rcvbuf->pages; > struct kvec *iov = rcvbuf->head; >- unsigned int nr, pglen = rcvbuf->page_len; >+ unsigned int nr = 0, pglen = rcvbuf->page_len; > uint32_t *end, *entry, *p, *kaddr; > uint32_t len, attrlen; > int hdrlen, recvd, status; >@@ -3056,7 +3056,12 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n > kaddr = p = (uint32_t *) kmap_atomic(page, KM_USER0); > end = (uint32_t *) ((char *)p + pglen + readdir->pgbase); > entry = p; >- for (nr = 0; *p++; nr++) { >+ >+ /* Make sure the packet actually has a value_follows and EOF entry */ >+ if ((entry + 1) > end) >+ goto short_pkt; >+ >+ for (; *p++; nr++) { > if (p + 3 > end) > goto short_pkt; > p += 2; /* cookie */ >@@ -3078,19 +3083,31 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n > goto short_pkt; > entry = p; > } >- if (!nr && (entry[0] != 0 || entry[1] == 0)) >- goto short_pkt; >+ /* >+ * Apparently some server sends responses that are a valid size, but >+ * contain no entries, and have value_follows==0 and EOF==0. For >+ * those, just set the EOF marker. >+ */ >+ if (!nr && entry[1] == 0) { >+ dprintk("NFS: readdir reply truncated!\n"); >+ entry[1] = 1; >+ } > out: > kunmap_atomic(kaddr, KM_USER0); > return 0; > short_pkt: >+ /* >+ * When we get a short packet there are 2 possibilities. We can >+ * return an error, or fix up the response to look like a valid >+ * response and return what we have so far. If there are no >+ * entries and the packet was short, then return -EIO. If there >+ * are valid entries in the response, return them and pretend that >+ * the call was successful, but incomplete. The caller can retry the >+ * readdir starting at the last cookie. >+ */ > entry[0] = entry[1] = 0; >- /* truncate listing ? */ >- if (!nr) { >- printk(KERN_NOTICE "NFS: readdir reply truncated!\n"); >- entry[1] = 1; >- } >- goto out; >+ if (nr) >+ goto out; > err_unmap: > kunmap_atomic(kaddr, KM_USER0); > return -errno_NFSERR_IO;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 443655
:
303354
|
303355
| 303356