linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org
Subject: Bug in xdr_copy_to_scratch???
Date: Wed, 16 Mar 2011 21:36:42 +1100	[thread overview]
Message-ID: <20110316213642.360be61d@notabene.brown> (raw)


Hi Trond,

 I'm currently trying to track down the cause of some very
odd behaviour in readdir in openSUSE 11.4 (2.6.37.3 based).

I think it might be caused by xdr_copy_to_scratch not quite
behaving correctly.

In particular, when it has to copy into the scratch buffer
it only copies 'nbytes' bytes - which sounds reasonable but
isn't.  It should copy XDR_QUADLEN(nbytes) words.

In particular, nfs3_decode_dirent contains:

	p = xdr_inline_decode(xdr, entry->len + 8);
	if (unlikely(!p))
		goto out_overflow;
	entry->name = (const char *) p;
	p += XDR_QUADLEN(entry->len);
	entry->prev_cookie = entry->cookie;
	p = xdr_decode_hyper(p, &entry->cookie);


where the cookie needs all of those last few bytes which
we would only get by rounding nbytes up to a multiple of 4.


I haven't developed or tested a fix yet, but as it is clearly a bug,
I thought I would let you know before I call it a night.

Thanks,
NeilBrown

             reply	other threads:[~2011-03-16 10:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-16 10:36 NeilBrown [this message]
2011-03-16 13:42 ` Bug in xdr_copy_to_scratch??? Trond Myklebust
2011-03-16 22:38   ` NeilBrown
2011-03-16 22:57     ` Trond Myklebust
2011-03-17 18:01     ` Trond Myklebust
2011-03-17 23:16       ` NeilBrown
2011-03-17 23:22         ` Trond Myklebust
2011-03-17 23:27           ` Trond Myklebust
2011-03-18  0:51             ` NeilBrown

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=20110316213642.360be61d@notabene.brown \
    --to=neilb@suse.de \
    --cc=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).