Linux NFS development
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Kinglong Mee <kinglongmee@gmail.com>
Cc: Avi Kivity <avi@cloudius-systems.com>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH] nfs: fix nfs4d readlink truncated packet
Date: Wed, 2 Jul 2014 17:42:04 -0400	[thread overview]
Message-ID: <20140702214204.GF11510@fieldses.org> (raw)
In-Reply-To: <53B3C56F.20406@gmail.com>

On Wed, Jul 02, 2014 at 04:40:15PM +0800, Kinglong Mee wrote:
> 
> On 7/1/2014 19:21, Avi Kivity wrote:
> > On 06/26/2014 05:23 PM, Avi Kivity wrote:
> >> XDR requires 4-byte alignment; nfs4d READLINK reply writes out the padding,
> >> but truncates the packet to the padding-less size.
> >>
> >> Fix by taking the padding into consideration when truncating the packet.
> >>
> > 
> > Ping.  I should have mentioned that without this, readlink() returns an I/O error on the client.

Thanks, queueing up for 3.16.

> Yes, I got
> [root@localhost ~]# ll /mnt/
> ls: cannot read symbolic link /mnt/test: Input/output error
> total 4
> -rw-r--r--. 1 root root  0 Jun 14 01:21 123456
> lrwxrwxrwx. 1 root root  6 Jul  2 03:33 test
> drwxr-xr-x. 1 root root  0 Jul  2 23:50 tmp
> drwxr-xr-x. 1 root root 60 Jul  2 23:44 tree
> [root@localhost ~]# 
> 
> It's introduced by commit 476a7b1f4b2c (nfsd4: don't treat readlink like a zero-copy operation).
...
> >> +    xdr_truncate_encode(xdr, length_offset + 4 + ALIGN(maxcount, 4));
> 
> NFSD uses (XDR_QUADLEN(maxcount) << 2)) usually.

Eh, I didn't know about ALIGN()--I think I prefer it.

> Anyway, it's a nice fix.
> 
> Reviewed-by: Kinglong Mee <kinglongmee@gmail.com>

Thanks!  I've also added your symptoms and the problematic commit to the
changelog.

--b.

      reply	other threads:[~2014-07-02 21:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-26 14:23 [PATCH] nfs: fix nfs4d readlink truncated packet Avi Kivity
2014-07-01 11:21 ` Avi Kivity
2014-07-02  8:40   ` Kinglong Mee
2014-07-02 21:42     ` J. Bruce Fields [this message]

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=20140702214204.GF11510@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=avi@cloudius-systems.com \
    --cc=kinglongmee@gmail.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