zfsonlinux/zfs — Issue #503: listxattr EFAULT
Author: chrisrd
Created: 2011-12-19 05:10:01+00:00
State: open

With spl e05bec8, zfs 30a9524, "set xattr=sa"...

I was getting an EFAULT when trying to read the xattrs on a specific file, which first showed up as an error when using "rsync -X" to copy into the ZFS fs. I went to have a closer look at the file:

brick# cd /pool/xxxx/xxxx
brick# getfattr -d xxxx
getfattr: xxxx: Bad address

...and tried setting an xattr, which it happily did without any apparent error, but reading it back again failed:

brick# setfattr -n user.foo -v foo xxxx
brick# getfattr -d xxxx
getfattr: xxxx: Bad address

Strace showed:

lstat("xxxx", {st_mode=S_IFREG|0650, st_size=932, ...}) = 0
listxattr("xxxx", (nil), 0) = -1 EFAULT (Bad address)

Changing the fs to "set xattr=dir" didn't help (it was then changed it back to 'sa'). I was able to successfully set xattrs on other files in the fs. E.g.:

brick# mv xxxx xxxx-
brick# cp -a xxxx- xxxx
brick# setfattr -n user.foo -v foo xxxx
brick# getfattr -d xxxx
# file: xxxx
user.foo="foo"

Also:

brick# mv xxxx- /pool/tmp/xxxx
mv: listing attributes of `xxxx-': Bad address
brick# cd /pool/tmp
brick# setfattr -n user.foo -v 'foo' 'xxxx'
brick# getfattr -d 'xxxx'
# file: xxxx
user.foo="foo"

Augh. So I've now lost the ability to reproduce the problem on that specific file. When it happens again, is there anything in particular I should be doing help track down the problem?