{"issue":{"title":"listxattr EFAULT","user":{"id":1211482,"login":"chrisrd","url":"https://api.github.com/users/chrisrd","avatar_url":"https://secure.gravatar.com/avatar/b78a3c14c9e91a607d5877f5a0d96c03?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b78a3c14c9e91a607d5877f5a0d96c03"},"milestone":null,"created_at":"2011-12-19T05:10:01Z","labels":[],"state":"open","updated_at":"2011-12-22T02:21:17Z","id":2596974,"html_url":"https://github.com/zfsonlinux/zfs/issues/503","closed_at":null,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"With spl e05bec8, zfs 30a9524, \"set xattr=sa\"...\r\n\r\nI 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:\r\n\r\n    brick# cd /pool/xxxx/xxxx\r\n    brick# getfattr -d xxxx\r\n    getfattr: xxxx: Bad address\r\n\r\n...and tried setting an xattr, which it happily did without any apparent error, but reading it back again failed:\r\n\r\n    brick# setfattr -n user.foo -v foo xxxx\r\n    brick# getfattr -d xxxx\r\n    getfattr: xxxx: Bad address\r\n\r\nStrace showed:\r\n\r\n    lstat(\"xxxx\", {st_mode=S_IFREG|0650, st_size=932, ...}) = 0\r\n    listxattr(\"xxxx\", (nil), 0) = -1 EFAULT (Bad address)\r\n\r\nChanging 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.:\r\n\r\n    brick# mv xxxx xxxx-\r\n    brick# cp -a xxxx- xxxx\r\n    brick# setfattr -n user.foo -v foo xxxx\r\n    brick# getfattr -d xxxx\r\n    # file: xxxx\r\n    user.foo=\"foo\"\r\n\r\nAlso:\r\n\r\n    brick# mv xxxx- /pool/tmp/xxxx\r\n    mv: listing attributes of `xxxx-': Bad address\r\n    brick# cd /pool/tmp\r\n    brick# setfattr -n user.foo -v 'foo' 'xxxx'\r\n    brick# getfattr -d 'xxxx'\r\n    # file: xxxx\r\n    user.foo=\"foo\"\r\n\r\nAugh. 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?\r\n","number":503,"url":"https://api.github.com/repos/zfsonlinux/zfs/issues/503","comments":5,"assignee":null},"comment":{"user":{"id":1211482,"login":"chrisrd","url":"https://api.github.com/users/chrisrd","avatar_url":"https://secure.gravatar.com/avatar/b78a3c14c9e91a607d5877f5a0d96c03?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"b78a3c14c9e91a607d5877f5a0d96c03"},"created_at":"2011-12-22T02:21:16Z","updated_at":"2011-12-22T02:21:16Z","id":3242687,"body":"Looking at one of the files with the xattr problem, and with \"getfattr -d\" vs \"getfattr -n\":\r\n\r\n    # getfattr -d bar\r\n    getfattr: bar: Bad address\r\n    # getfattr -n user.rsync.%stat bar\r\n    bar: user.rsync.%stat: No such attribute\r\n\r\nI'm confident the 'user.rsync.%stat' xattr would have been set on the file as it's a part of the rsync transfer. Then, explicitly setting that xattr:\r\n\r\n    # setfattr -n user.rsync.%stat -v '100700 0,0 264210240:264210240' bar\r\n    # getfattr -n user.rsync.%stat bar\r\n    # file: bar\r\n    user.rsync.%stat=\"100700 0,0 264210240:264210240\"\r\n    # getfattr -d bar\r\n    getfattr: bar: Bad address\r\n\r\nThe stap output for the '-d' case:\r\n\r\n    # stap ~chris/para-callgraph.stp 'module(\"zfs\").function(\"*@module/zfs/*.c\")' 'module(\"zfs\").function(\"zpl_xattr_list\")' -c \"getfattr -d bar\"\r\n    getfattr: bar: Bad address\r\n    Warning: child process exited with status 1\r\n         0 getfattr(12278):->zfs_sa_get_xattr zp=0xffff88019ce514b8\r\n        11 getfattr(12278): ->sa_size hdl=0xffff88019ce18ce8 attr=0x14 size=0xffff88005fc09e24\r\n        20 getfattr(12278):  ->sa_attr_op hdl=0xffff88019ce18ce8 bulk=0xffff88005fc09da8 count=0x1 data_op=0x0 tx=0x0\r\n        25 getfattr(12278):  <-sa_attr_op return=0x0\r\n        28 getfattr(12278): <-sa_size return=0x0\r\n        35 getfattr(12278): ->sa_spill_alloc flags=0xd0\r\n      1510 getfattr(12278): <-sa_spill_alloc return=0xffffc90071fe7158\r\n      1561 getfattr(12278): ->sa_lookup hdl=0xffff88019ce18ce8 attr=0x14 buf=0xffffc90071fe7158 buflen=0x18\r\n      1569 getfattr(12278):  ->sa_lookup_impl hdl=0xffff88019ce18ce8 bulk=0xffff88005fc09db8 count=0x1\r\n      1575 getfattr(12278):   ->sa_attr_op hdl=0xffff88019ce18ce8 bulk=0xffff88005fc09db8 count=0x1 data_op=0x0 tx=0x0\r\n      1579 getfattr(12278):   <-sa_attr_op return=0x0\r\n      1582 getfattr(12278):  <-sa_lookup_impl return=0x0\r\n      1585 getfattr(12278): <-sa_lookup return=0x0\r\n      1596 getfattr(12278): ->sa_spill_free obj=0xffffc90071fe7158\r\n      1601 getfattr(12278): <-sa_spill_free \r\n      1604 getfattr(12278):<-zfs_sa_get_xattr return=0xe\r\n    Error removing module 'stap_72ec80d66c7c760846c26c364b9fcf5f_1_12277': Device or resource busy.\r\n    Warning: /usr/bin/staprun exited with status: 1\r\n    Pass 5: run failed.  Try again with another '--vp 00001' option.\r\n\r\nThe stap output for the '-v' case:\r\n\r\n    # stap ~chris/para-callgraph.stp 'module(\"zfs\").function(\"*@module/zfs/*.c\")' 'module(\"zfs\").function(\"zpl_xattr_list\")' -c \"getfattr -n user.rsync.%stat bar\"\r\n    # file: bar\r\n    user.rsync.%stat=\"100700 0,0 264210240:264210240\"\r\n\r\n    Error removing module 'stap_72ec80d66c7c760846c26c364b9fcf5f_1_14775': Device or resource busy.\r\n    Warning: /usr/bin/staprun exited with status: 1\r\n    Pass 5: run failed.  Try again with another '--vp 00001' option.\r\n\r\nHuh? No zfs usage at all? ...or, more likely, stap simply isn't being told to trace the relevant path. At this point my knowledge of what the relevant path might be, how to point stap towards it, and whether it's even relevant, all fail me!\r\n","url":"https://api.github.com/repos/zfsonlinux/zfs/issues/comments/3242687"},"action":"created"}