Skip to contentSkip to conversation

Problems with default ACLs over NFS

DISCUSSION J.A. Magallón 5 participants 8 messages Mar 23, 2009 – Apr 21, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi all...

I have a strange problem with 2.6.29-rc8-git3.
It looks like a kernel bug... ?

I have a box with NFS autofs-mounted home directories. Server is a Solaris 10 system. This worked in previous kernel versions, so I don't blame Solaris, at this moment.

With this acls set in my home:

prometeo:~> getfacl .

# file: .
# owner: magallon
# group: giga
user::rwx
user:webservd:r-x #effective:r-x
group::--x #effective:--x
mask:r-x
other:--x
default:user::rwx
default:group::--x
default:other:--x

I get this strange message in the linux client:

cicely:~> mkdir kk
mkdir: cannot create directory `kk': Invalid argument

But the directory is created, and its ACLs are correct:

prometeo:~> getfacl kk

# file: kk
# owner: magallon
# group: giga
user::rwx
group::--x #effective:--x
other:--x
default:user::rwx
default:group::--x
default:other:--x

If I remove the 'default' entries, the error message goes away.

With strace, I get this:

mkdir("kk", 0777) = -1 EINVAL (Invalid argument)

Mount info from /proc/mounts:

ldap:danae-nfs:automountMapName=auto_home,o=diis /home autofs rw,fd=7,pgrp=3165,timeout=600,minproto=5,maxproto=5,indirect 0 0

danae-nfs:/export/home/usuarios/giga/magallon /home/magallon nfs rw,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nointr,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=155.210.152.202,mountvers=3,mountproto=tcp,addr=155.210.152.202 0 0

It happens the same If I try to create a file with "> kk", or try to cp -r one other dir, but "touch kk" works.

Any idea ?

TIA

Signature · 4 lines
J.A. Magallon <jamagallon()ono!com>     \               Software is like sex:
                                         \         It's better when it's free
Mandriva Linux release 2009.1 (Cooker) for x86_64
Linux 2.6.28.2-desktop-1mnb (gcc 4.3.2 (GCC) #1 Wed Jan
#1 lore raw

(cc linux-nfs)

Quoted 62 lines · On Mon, 23 Mar 2009 22:24:27 +0100 "J.A. Magall__n"…

Hi all...

I have a strange problem with 2.6.29-rc8-git3.
It looks like a kernel bug... ?

I have a box with NFS autofs-mounted home directories. Server is a Solaris 10 system. This worked in previous kernel versions, so I don't blame Solaris, at this moment.

With this acls set in my home:

prometeo:~> getfacl .

# file: .
# owner: magallon
# group: giga
user::rwx
user:webservd:r-x #effective:r-x
group::--x #effective:--x
mask:r-x
other:--x
default:user::rwx
default:group::--x
default:other:--x

I get this strange message in the linux client:

cicely:~> mkdir kk
mkdir: cannot create directory `kk': Invalid argument

But the directory is created, and its ACLs are correct:

prometeo:~> getfacl kk

# file: kk
# owner: magallon
# group: giga
user::rwx
group::--x #effective:--x
other:--x
default:user::rwx
default:group::--x
default:other:--x

If I remove the 'default' entries, the error message goes away.

With strace, I get this:

mkdir("kk", 0777) = -1 EINVAL (Invalid argument)

Mount info from /proc/mounts:

ldap:danae-nfs:automountMapName=auto_home,o=diis /home autofs rw,fd=7,pgrp=3165,timeout=600,minproto=5,maxproto=5,indirect 0 0

danae-nfs:/export/home/usuarios/giga/magallon /home/magallon nfs rw,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nointr,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=155.210.152.202,mountvers=3,mountproto=tcp,addr=155.210.152.202 0 0

It happens the same If I try to create a file with "> kk", or try to cp -r one other dir, but "touch kk" works.

Any idea ?

#2 lore raw
Quoted 13 lines · On Mon, 23 Mar 2009 22:24:27 +0100 "J.A. Magall__n" <[email protected]> wrote:
Quoted 11 lines

Hi all...

I have a strange problem with 2.6.29-rc8-git3.
It looks like a kernel bug... ?

I have a box with NFS autofs-mounted home directories. Server is a Solaris 10 system. This worked in previous kernel versions, so I don't blame Solaris, at this moment.

With this acls set in my home:

	:::
Quoted 4 lines
Quoted 4 lines

I get this strange message in the linux client:

cicely:~> mkdir kk
mkdir: cannot create directory `kk': Invalid argument

I met a similar problem.
In linux-2.6.29 with CONFIG_NFS_V3_ACL enabled,
when I executed "cp -p /local/ext2/file /nfsv3/file", I got EINVAL too. Strace-ing this cp, I found setxsttr() return EINVAL. Before 2.6.29, it was EOPNOTSUPPORTED.

Tracing some kernel functions, I observed several thigs.
- xdr_buf_subsegment() returned -1 due to 'len' is not 0.
- xdr_encode_word() call from nfsacl_encode() got this -1, and nfsacl_encode/nfs3_xdr_setaclargs/nfs3_proc_setacls/nfs3_proc_setacl/nfs3_setxattr returned -EINVAL.

Finally I am afraid this commit might be related to this issue.

commit ae46141ff08f1965b17c531b571953c39ce8b9e2

Author: Trond Myklebust <[email protected]>
Date:   Tue Mar 10 20:33:18 2009 -0400

NFSv3: Fix posix ACL code

Fix a memory leak due to allocation in the XDR layer. In cases where the RPC call needs to be retransmitted, we end up allocating new pages without clearing the old ones. Fix this by moving the allocation into nfs3_proc_setacls().

Also fix an issue discovered by Kevin Rudd, whereby the amount of memory reserved for the acls in the xdr_buf->head was miscalculated, and causing corruption.

J. R. Okajima

#3 lore raw
Quoted 7 lines · hooanon05-/[email protected] wrote:
Quoted 7 lines · On Mon, 23 Mar 2009 22:24:27 +0100 "J.A. Magall__n"…
Quoted 6 lines

Hi all...

I have a strange problem with 2.6.29-rc8-git3.
It looks like a kernel bug... ?

Quoted 10 lines
Quoted 5 lines
Quoted 5 lines

I have a box with NFS autofs-mounted home directories. Server is a Solaris 10 system. This worked in previous kernel versions, so I don't blame Solaris, at this moment.

With this acls set in my home:

	:::
Quoted 4 lines
Quoted 4 lines

I get this strange message in the linux client:

cicely:~> mkdir kk
mkdir: cannot create directory `kk': Invalid argument

The following patch from Trond should fix this issue, I think.

From: Trond Myklebust <[email protected]>
Date: Wed, 15 Apr 2009 13:58:45 -0400
Subject: [PATCH] NFS: Fix the XDR iovec calculation in nfs3_xdr_setaclargs

Commit ae46141ff08f1965b17c531b571953c39ce8b9e2 (NFSv3: Fix posix ACL code) introduces a bug in the calculation of the XDR header iovec. In the case where we are inlining the acls, we need to adjust the length of the iovec req->rq_svec, in addition to adjusting the total buffer length.

---
 fs/nfs/nfs3xdr.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
fs/nfs/nfs3xdr.c +2 -1
index e6a1932..35869a4 100644
@@ -713,7 +713,8 @@ nfs3_xdr_setaclargs(struct rpc_rqst *req, __be32 *p,
 	if (args->npages != 0)
 		xdr_encode_pages(buf, args->pages, 0, args->len);
 	else
-		req->rq_slen += args->len;
+		req->rq_slen = xdr_adjust_iovec(req->rq_svec,
+				p + XDR_QUADLEN(args->len));
 
 	err = nfsacl_encode(buf, base, args->inode,
 			    (args->mask & NFS_ACL) ?
Quoted 31 lines

Tracing some kernel functions, I observed several thigs.
- xdr_buf_subsegment() returned -1 due to 'len' is not 0.
- xdr_encode_word() call from nfsacl_encode() got this -1, and nfsacl_encode/nfs3_xdr_setaclargs/nfs3_proc_setacls/nfs3_proc_setacl/nfs3_setxattr returned -EINVAL.

Finally I am afraid this commit might be related to this issue.

commit ae46141ff08f1965b17c531b571953c39ce8b9e2

Author: Trond Myklebust <[email protected]>
Date:   Tue Mar 10 20:33:18 2009 -0400

NFSv3: Fix posix ACL code

Fix a memory leak due to allocation in the XDR layer. In cases where the RPC call needs to be retransmitted, we end up allocating new pages without clearing the old ones. Fix this by moving the allocation into nfs3_proc_setacls().

Also fix an issue discovered by Kevin Rudd, whereby the amount of memory reserved for the acls in the xdr_buf->head was miscalculated, and causing corruption.

J. R. Okajima
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Suresh Jayaraman
#4 lore raw

Suresh Jayaraman:

Quoted 11 lines

The following patch from Trond should fix this issue, I think.

From: Trond Myklebust <[email protected]>
Date: Wed, 15 Apr 2009 13:58:45 -0400
Subject: [PATCH] NFS: Fix the XDR iovec calculation in nfs3_xdr_setaclargs

Commit ae46141ff08f1965b17c531b571953c39ce8b9e2 (NFSv3: Fix posix ACL code) introduces a bug in the calculation of the XDR header iovec. In the case where we are inlining the acls, we need to adjust the length of the iovec req->rq_svec, in addition to adjusting the total buffer length.

Thanx.
But which tree is this patch applied?

J. R. Okajima

#5 lore raw
Quoted 8 lines · hooanon05-/[email protected] wrote:

Suresh Jayaraman:

Quoted 7 lines

The following patch from Trond should fix this issue, I think.

From: Trond Myklebust <[email protected]>
Date: Wed, 15 Apr 2009 13:58:45 -0400
Subject: [PATCH] NFS: Fix the XDR iovec calculation in nfs3_xdr_setaclargs

Quoted 8 lines
Quoted 4 lines

Commit ae46141ff08f1965b17c531b571953c39ce8b9e2 (NFSv3: Fix posix ACL code) introduces a bug in the calculation of the XDR header iovec. In the case where we are inlining the acls, we need to adjust the length of the iovec req->rq_svec, in addition to adjusting the total buffer length.

Thanx.
But which tree is this patch applied?

Not yet applied. I guess it's queued up in Trond's git.

Thanks,

Signature · 1 line
Suresh Jayaraman
#6 lore raw
Quoted 1 line · Suresh Jayaraman

Not yet applied. I guess it's queued up in Trond's git.

Any chance for getting this into 2.6.29.2?

Sven

Signature · 4 lines
"Thinking of using NT for your critical apps?
                                  Isn't there enough suffering in the world?"
                   (Advertisement of Sun Microsystems in Wall Street Journal)
/me is giggls@ircnet, http://sven.gegg.us/ on the Web