[LU-11107] getxattr() returns 0 length values for nonexistent xattrs (with xattr_cache=0) Created: 29/Jun/18 Updated: 03/Aug/18 Resolved: 24/Jul/18 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Lustre 2.12.0, Lustre 2.10.5 |
| Type: | Bug | Priority: | Minor |
| Reporter: | John Hammond | Assignee: | John Hammond |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | xattr | ||
| Issue Links: |
|
||||||||
| Severity: | 3 | ||||||||
| Rank (Obsolete): | 9223372036854775807 | ||||||||
| Description |
|
When the xattr cache is disabled (or when we bypass it as in o:~# lctl set_param llite.*.xattr_cache=0
llite.lustre-ffff8c4ac8a60000.xattr_cache=0
o:~# cd /mnt/lustre
o:lustre# touch f0
o:lustre# getfattr -d -m- f0
# file: f0
lustre.lov=0s0AvRCwEAAAABAAAAAAAAAAEEAAACAAAAAAAQAAEAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
trusted.link=0s3/HqEQEAAAAsAAAAAAAAAAAAAAAAAAAAABQAAAACAAAABwAAAAEAAAAAZjA=
trusted.lma=0sAAAAAAAAAAABBAAAAgAAAAEAAAAAAAAA
trusted.lov=0s0AvRCwEAAAABAAAAAAAAAAEEAAACAAAAAAAQAAEAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
trusted.version=0sAQAAAAEAAAA=
o:lustre# getfattr -d -n user.blah f0
# file: f0
user.blah
o:lustre# strace getfattr -d -n user.blah f0
...
lstat("f0", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
getxattr("f0", "user.blah", NULL, 0) = 0
getxattr("f0", "user.blah", NULL, 0) = 0
...
After reenabling the xattr cache getxattr() works as expected: o:lustre# lctl set_param llite.*.xattr_cache=1 llite.lustre-ffff8c4ac8a60000.xattr_cache=1 o:lustre# getfattr -d -n user.blah f0 f0: user.blah: No such attribute This is because in mdt_getxattr_pack_reply() if the xattr doesn't exist then we return 0. And in mdt_getxattr() we have the following:
easize = mdt_getxattr_pack_reply(info);
if (easize < 0)
GOTO(out, rc = err_serious(easize));
repbody = req_capsule_server_get(info->mti_pill, &RMF_MDT_BODY);
LASSERT(repbody != NULL);
/* No need further getxattr. */
if (easize == 0 || reqbody->mbo_eadatasize == 0)
GOTO(out, rc = easize);
|
| Comments |
| Comment by Gerrit Updater [ 02/Jul/18 ] |
|
John L. Hammond (jhammond@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/32753 |
| Comment by Gerrit Updater [ 24/Jul/18 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/32753/ |
| Comment by Peter Jones [ 24/Jul/18 ] |
|
Landed for 2.12 |
| Comment by Gerrit Updater [ 01/Aug/18 ] |
|
Minh Diep (mdiep@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/32910 |
| Comment by Gerrit Updater [ 03/Aug/18 ] |
|
John L. Hammond (jhammond@whamcloud.com) merged in patch https://review.whamcloud.com/32910/ |