Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 162664 - sys-apps/acl-2.2.39-r1 broken on jfs with nfs use-flag
Summary: sys-apps/acl-2.2.39-r1 broken on jfs with nfs use-flag
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
: 167290 177083 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-18 14:47 UTC by Alexander Zubkov
Modified: 2007-09-20 06:17 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
acl_set_file: Don't use XATTR_REPLACE on non-NFS files (acl-2.2.29-nfs-setxattr.patch,665 bytes, patch)
2007-03-21 22:10 UTC, Heath Kehoe
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Zubkov 2007-01-18 14:47:14 UTC
When sys-apps/acl-2.2.39-r1 is compiled with nfs use-flag, there is problems with acl's on jfs filesystem.
Bug tested on stable (x86) with 2.6.18-gentoo-r6 kernel and on unstable (~x86) with 2.6.19-gentoo-r4 kernel.
To reproduce this bug:
# dd if=/dev/zero of=img bs=1M count=16
# mkdir mnt
# mkfs.jfs img
# mount -o loop img mnt
# touch mnt/test
# setfacl -m u:<user>:rw mnt/test
(where <user> is some valid user)
The result will be:
"setfacl: mnt/test: No data available"

Here is strace cut of this call:
...
readlink("mnt/test", 0x804d3c0, 4095)   = -1 EINVAL (Invalid argument)
lstat64("mnt/test", {st_mode=S_IFREG|0664, st_size=0, ...}) = 0
getxattr("mnt/test", "system.nfs4_acl", 0xbfaa8870, 132) = -1 ENODATA (No data available)
getxattr("mnt/test", "system.posix_acl_access", 0xbfaa8870, 132) = -1 ENODATA (No data available)
stat64("mnt/test", {st_mode=S_IFREG|0664, st_size=0, ...}) = 0
getxattr("mnt/test", "system.nfs4_acl", 0x0, 0) = -1 ENODATA (No data available)
setxattr("mnt/test", "system.posix_acl_access", "\x02\x00\x00\x00\x01\x00\x06\x00\xff\xff\xff\xff\x02\x00\x06\x00\xe8\x03\x00\x00\x04\x00\x06\x00\xff\xff\xff\xff\x10\x00\x06\x00\xff\xff\xff\xff \x00\x04\x00\xff\xff\xff\xff", 44, XATTR_REPLACE) = -1 ENODATA (No data available)
...

Here is ltrace cut of this call:
...
acl_copy_entry(0x8052cf4, 0x8052c80)             = 0
acl_set_tag_type(0x8052cf4, 16)                  = 0
acl_calc_mask(0xbfadc250)                        = 0
acl_check(0x8052c3c, 0xbfadc240)                 = 0
acl_cmp(0x8052bac, 0x8052c3c)                    = 1
acl_set_file("mnt/test", 32768, 0x8052c3c)       = -1
__errno_location()                               = 0xb7fd8690
strerror(61)                                     = "No data available"
...

If sys-apps/acl is compiled with USE="-nfs" than this command is working properly.
Cut of strace:
...
readlink("mnt/test", 0x804d380, 4095)   = -1 EINVAL (Invalid argument)
lstat64("mnt/test", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
getxattr("mnt/test", "system.posix_acl_access", 0xbfdd7690, 132) = -1 ENODATA (No data available)
stat64("mnt/test", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
setxattr("mnt/test", "system.posix_acl_access", "\x02\x00\x00\x00\x01\x00\x06\x00\xff\xff\xff\xff\x02\x00\x06\x00\x00\x00\x00\x00\x04\x00\x04\x00\xff\xff\xff\xff\x10\x00\x06\x00\xff\xff\xff\xff \x00\x04\x00\xff\xff\xff\xff", 44, 0) = 0
...

Cut of ltrace:
...
acl_get_entry(0x80518d4, 1, 0xbfd31ee8)          = 1
acl_get_tag_type(0x8051918, 0xbfd31ee4)          = 0
acl_create_entry(0xbfd31f90, 0xbfd31f20)         = 0
acl_copy_entry(0x805198c, 0x8051918)             = 0
acl_set_tag_type(0x805198c, 16)                  = 0
acl_calc_mask(0xbfd31f90)                        = 0
acl_check(0x80518d4, 0xbfd31f80)                 = 0
acl_cmp(0x8051844, 0x80518d4)                    = 1
acl_set_file("mnt/test", 32768, 0x80518d4)       = 0
acl_free(0x80518d4)                              = 0
acl_free(0x8051844)                              = 0
...

There is no such problem with reiserfs, at least. Do not tested other filesystems.
Comment 1 Torsten Krah 2007-01-19 12:47:53 UTC
I got these problems too compiling acl with nfs flag on xfs FS.

Torsten
Comment 2 Heath Kehoe 2007-03-21 22:10:25 UTC
Created attachment 114019 [details, diff]
acl_set_file: Don't use XATTR_REPLACE on non-NFS files

This must be applied after acl-2.2.29-CITI_NFS4_ALL-3.dif
Comment 3 Heath Kehoe 2007-03-21 22:10:45 UTC
I ran into this issue as well, but in cp -Rp.

The difference is in the USE=nfs build, the setxattr call has XATTR_REPLACE; where in the non-nfs build, it doesn't.  (The NFS patch adds the XATTR_REPLACE).

The breakage is because setxattr is supposed to fail (errno=ENOATTR) if XATTR_REPLACE is specified and the file doesn't have the attr to begin with; which means that acl_set_file() will never be able to add an acl to a file that lacks an acl to begin with.

I see two ways to fix this:

1) only use XATTR_REPLACE if the target file is NFS

2) test the return value of setxattr(..., XATTR_REPLACE). If -1 and errno == ENOATTR, do the setxattr() again without XATTR_REPLACE.

I prefer the first option, because the second adds the extra syscall.  Attached is the patch I used on my system, which has fixed the problem for me.
Comment 4 Jakub Moc (RETIRED) gentoo-dev 2007-05-04 20:03:54 UTC
*** Bug 167290 has been marked as a duplicate of this bug. ***
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2007-05-04 20:04:28 UTC
*** Bug 177083 has been marked as a duplicate of this bug. ***
Comment 6 Fred Röhner 2007-05-05 13:50:26 UTC
Upgrading to sys-libs/glibc-2.5-r2 failed on jfs:
- applied recommended patch for "XATTR_REPLACE on non-NFS files" on sys-apps/acl
- emerge upgrade of sys-libs/glibc completed without any error!

sys-apps/acl-2.2.39-r1  USE="nfs nls"
sys-fs/jfsutils-1.1.8
x86: 2.6.20-gentoo-r7

Please add patch to acl ebuild!
Comment 7 J. Bruce Fields 2007-05-09 20:03:16 UTC
I'm not sure how that XATTR_REPLACE crept in there in the first place--it looks like a mistake.  Just remove it and make that argument a zero unconditionally.  I've pushed out an updated version with that fix to

  git://linux-nfs.org/~bfields/acl.git

Browsable version at

  http://www.linux-nfs.org/cgi-bin/gitweb.cgi?p=bfields-acl.git;a=summary

(PS: Is there a way I could be cc:'d on any bugs related to the citi nfsv4 acl stuff?)
Comment 8 SpanKY gentoo-dev 2007-09-20 06:17:09 UTC
acl-2.2.45 has latest NFS patch

J. Bruce Fields: there is no way to filter specifically on the nfs patch, but i can add you as a cc when a new one comes up ...