Re: [PATCH] convert dm_ulog_request data to little endian

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Aug 19, 2014, at 10:19 PM, zhangdongmao wrote:

> 
> 于 2014年08月20日 08:58, Brassow Jonathan 写道:
>> This seems odd to me.  I don't understand why you would get a bug.  Do you have a mixed-architecture cluster?  Some x86-64 and the s390?  Otherwise, all operations should be in a format that is understood (unless there is a bug).
>> 
>> Also, you don't really need to translate the structure just to go to userspace.  Only the process that communicates between (potentially different architectures of) machines needs to do that.  That process is cmirrord and the code that should translate for that daemon is in lvm2/daemons/cmirrord/compat.c.
>> 
>> There could be a bug, but unless I'm not understanding right, we shouldn't need to switch endian in the kernel.
>> 
>>  brassow
>> 
> I think this is because cmirrord always assume the network package is little-endian.(see compat.c: v5_endian_from_network) .
> So if cmirrord is running on S390, kernel will send package in its native endian(big endian), this is why data is broken.
> There might have two solutions:
> 
> 1. cmirrord always use native endian.
> 2. kernel always send little endian data.

v5_endian_from_network() only gets called if it is needed.  I suspect there is a bug here, 'clog_request_to_network' should detect if big endian is being used and switch it to little endian.  In-coming communication must always be little endian.  I'm not sure which end the problem is on (I think the send side).  You could add some prints to detect the issue.

lvm2/daemons/cmirrord/cluster.c:cluster_send() sets two version numbers - one is forced to be little endian via xlate64().  'clog_request_to_network()' is then called and compares the two version numbers.  If they are different, the machine is big endian and the contents must be converted.  If this is not happening, it is bad.  Then, *from_network() performs a similar action and test and then must xlate back to big endian.  If this is not happening, it is bad.  So, for big endian machines, ensure that v5_endian_*_network() is being called.  (For little endian, it should not be.)

 brassow

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel





[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux