Linux NFS development
 help / color / mirror / Atom feed
From: Suresh Jayaraman <sjayaraman@suse.de>
To: Trond.Myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH] NFS: Fix send buffer length calculation in nfs3_xdr_setaclargs()
Date: Wed, 15 Apr 2009 19:40:46 +0530	[thread overview]
Message-ID: <49E5EAE6.7000507@suse.de> (raw)

The recent posixacl fix(commit ae46141ff08f1965b17c531b571953c39ce8b9e2)
seems to have introduced a bug that will lead to -EINVAL errors during
normal setfacl operations on file or dir. This patch attempts to fix
this.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
---

diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index e6a1932..7cd0069 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -702,18 +702,19 @@ nfs3_xdr_setaclargs(struct rpc_rqst *req, __be32 *p,
                    struct nfs3_setaclargs *args)
 {
 	struct xdr_buf *buf = &req->rq_snd_buf;
-	unsigned int base;
+	unsigned int base, len;
+	unsigned int len_in_head = 2 * (2 + 3 * NFS_ACL_MAX_ENTRIES_INLINE);
 	int err;
 
 	p = xdr_encode_fhandle(p, NFS_FH(args->inode));
 	*p++ = htonl(args->mask);
-	req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
-	base = req->rq_slen;
+	len = xdr_adjust_iovec(req->rq_svec, p);
+	base = len;
+	len -= len_in_head; 
+	req->rq_slen = xdr_adjust_iovec(req->rq_svec, p + (len >> 2));
 
 	if (args->npages != 0)
-		xdr_encode_pages(buf, args->pages, 0, args->len);
-	else
-		req->rq_slen += args->len;
+		xdr_encode_pages(buf, args->pages, 0, len);
 
 	err = nfsacl_encode(buf, base, args->inode,
 			    (args->mask & NFS_ACL) ?



             reply	other threads:[~2009-04-15 14:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-15 14:10 Suresh Jayaraman [this message]
2009-04-15 18:00 ` [PATCH] NFS: Fix send buffer length calculation in nfs3_xdr_setaclargs() Trond Myklebust
     [not found]   ` <1239818456.5177.88.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-04-15 20:11     ` Leonardo Chiquitto
2009-04-16  5:17     ` Suresh Jayaraman
2009-04-16 13:52       ` Chuck Lever
2009-04-16 16:42         ` Trond Myklebust
     [not found]           ` <1239900127.4198.5.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2009-04-16 18:00             ` Chuck Lever

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=49E5EAE6.7000507@suse.de \
    --to=sjayaraman@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