]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
client: fix _listxattr() vxattr buffer length calculation
authorDavid Disseldorp <ddiss@suse.de>
Mon, 15 Apr 2019 17:38:10 +0000 (19:38 +0200)
committerDavid Disseldorp <ddiss@suse.de>
Mon, 15 Apr 2019 23:31:04 +0000 (01:31 +0200)
commitab97ff746acd2a85c22c2116d450e95afb39d18a
tree570307dc0b3bdfd014f8db578de756344b6a2c0c
parentefb3ddd9a49b81f2ab23d86a5b025630f3424050
client: fix _listxattr() vxattr buffer length calculation

Client::_listxattr() incorrectly returns a length based on the static
_vxattrs_name_size() value. _vxattrs_calcu_name_size() only takes into
account whether vxattrs are hidden, ignoring vxattr.exists_cb().

When filling the xattr buffer, Client::_listxattr() checks vxattr.hidden
and vxattr.exists_cb(). When the latter returns false (as is the case
for ceph.snap.btime on non-snapshots), we return a length which is
larger than the amount that we wrote to the buffer.

Fix this behaviour by always calculating the vxattrs length at runtime,
taking both vxattr.hidden and vxattr.exists_cb() into account.

Signed-off-by: David Disseldorp <ddiss@suse.de>
src/client/Client.cc