On Wed, Apr 17, 2013 at 10:05 AM, Sage Weil <s...@inktank.com> wrote:
> [Adding Brian to CC list again :)]
>
> On Wed, 17 Apr 2013, Yehuda Sadeh wrote:
>
>> On Wed, Apr 17, 2013 at 9:37 AM, Jeff Mitchell
>> <jeffrey.mitch...@gmail.com> wrote:
>> > Henry C Chang wrote:
>> >>
>> >> I looked into this problem earlier. The problem is that zfs does not
>> >> return ERANGE when the size of value buffer passed to getxattr is too
>> >> small. zfs returns with truncated xattr value.
>> >
>> >
>> > Is this a bug in ZFS, or simply different behavior?
>>
>> Took a brief look at the zfs code, seems like a zfs bug.
>>
>> diff --git a/module/zfs/zpl_xattr.c b/module/zfs/zpl_xattr.c
>> index c03764f..96db7dd 100644
>> --- a/module/zfs/zpl_xattr.c
>> +++ b/module/zfs/zpl_xattr.c
>> @@ -263,6 +263,9 @@ zpl_xattr_get_sa(struct inode *ip, const char
>> *name, void *value, size_t size)
>>         if (!size)
>>                 return (nv_size);
>>
>> +       if (size < nv_size)
>> +               return (-ERANGE);
>> +
>>         memcpy(value, nv_value, MIN(size, nv_size));
>>
>>         return (MIN(size, nv_size));
>>
>>
>> This should fix it. Not tested of course.

Well, looking at the code again it's not going to work, as setxattr is
going to fail with ERANGE.

Yehuda
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to