@@ -219,13 +219,15 @@ static struct ceph_inode_xattr *__get_xattr(struct ceph_inode_info *ci,
struct rb_node **p;
struct rb_node *parent = NULL;
struct ceph_inode_xattr *xattr = NULL;
- int c;
+ int c, name_len = strlen(name);
p = &ci->i_xattrs.index.rb_node;
while (*p) {
parent = *p;
xattr = rb_entry(parent, struct ceph_inode_xattr, node);
- c = strncmp(name, xattr->name, xattr->name_len);
+ c = name_len - xattr->name_len;
+ if (!c)
+ c = strncmp(name, xattr->name, xattr->name_len);
if (c < 0)
p = &(*p)->rb_left;
else if (c > 0)