cmirrord:fix endian issue on s390
PATCH 1/1 cmirrord:fix endian issue on s390
Cmirrord has endian bugs, which cause failure to lvcreate a mirrored lv on s390.
- data_size is uint32, should not use xlate64 to convert, which will cause data_size 0 after xlate.
- request_type and data_size still used by local(v5_data_switch), should convert later. if request_type xlate too early, it will cause request_type judge error; if data_size xlate too early, it will cause coredump in case DM_ULOG_CLEAR_REGION.
- when receiving package in clog_request_from_network. vp[0] will always be little endian. we could use xlate64(vp[0]) == vp[0] to decide if the local node is little endian or not.
--- daemons/cmirrord/compat.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
daemons/cmirrord/compat.c +5 -4
@@ -126,13 +126,14 @@ static int v5_endian_to_network(struct clog_request *rq) u_rq->error =xlate32 (u_rq->error); u_rq->seq =xlate32 (u_rq->seq); - u_rq->request_type =xlate32 (u_rq->request_type); - u_rq->data_size =xlate64 (u_rq->data_size); rq->originator =xlate32 (rq->originator);v5_data_endian_switch (rq,1 ); + u_rq->request_type =xlate32 (u_rq->request_type); + u_rq->data_size =xlate32 (u_rq->data_size); +return size; }
@@ -167,7 +168,7 @@ static int v5_endian_from_network(struct clog_request *rq) u_rq->error =xlate32 (u_rq->error); u_rq->seq =xlate32 (u_rq->seq); u_rq->request_type =xlate32 (u_rq->request_type); - u_rq->data_size =xlate64 (u_rq->data_size); + u_rq->data_size =xlate32 (u_rq->data_size); rq->originator =xlate32 (rq->originator);
@@ -187,7 +188,7 @@ int clog_request_from_network(void *data, size_t data_len)switch (version) {case 5 :/* Upstream */ -if (version == unconverted_version) +if (version == vp[0 ])return 0 ;break ;case 4 :/* RHEL 5.[45] */
Signature · 1 line
1.9.0
PATCH 1/1 cmirrord:fix endian issue on s390
Yes, this is the sort of patch I'm looking for. Can you confirm it works for s390 and x86[_64]? That patch looks good to me otherwise.
brassow
Quoted 61 lines · Liuhua Wang
Cmirrord has endian bugs, which cause failure to lvcreate a mirrored lv on s390.
-data_sizeis uint32, should not use xlate64 to convert, which will causedata_size0 after xlate.
-request_typeanddata_sizestill used bylocal(v5_data_switch), should convert later. ifrequest_typexlate too early, it will causerequest_typejudge error; ifdata_sizexlate too early, it will cause coredump in caseDM_ULOG_CLEAR_REGION.
- when receiving package inclog_request_from_network. vp[0] will always be little endian. we could usexlate64(vp[0])== vp[0] to decide if the local node is little endian or not.---
daemons/cmirrord/compat.c| 9 +++++----1 file changed, 5 insertions(+), 4 deletions(-)daemons/cmirrord/compat.c +5
-4@@ -126,13 +126,14 @@ static int v5_endian_to_network(struct clog_request *rq) u_rq->error =xlate32 (u_rq->error); u_rq->seq =xlate32 (u_rq->seq); - u_rq->request_type =xlate32 (u_rq->request_type); - u_rq->data_size =xlate64 (u_rq->data_size); rq->originator =xlate32 (rq->originator);v5_data_endian_switch (rq,1 ); + u_rq->request_type =xlate32 (u_rq->request_type); + u_rq->data_size =xlate32 (u_rq->data_size); +return size; }@@ -167,7 +168,7 @@ static int v5_endian_from_network(struct clog_request *rq) u_rq->error =xlate32 (u_rq->error); u_rq->seq =xlate32 (u_rq->seq); u_rq->request_type =xlate32 (u_rq->request_type); - u_rq->data_size =xlate64 (u_rq->data_size); + u_rq->data_size =xlate32 (u_rq->data_size); rq->originator =xlate32 (rq->originator);@@ -187,7 +188,7 @@ int clog_request_from_network(void *data, size_t data_len)switch (version) {case 5 :/* Upstream */ -if (version == unconverted_version) +if (version == vp[0 ])return 0 ;break ;case 4 :/* RHEL 5.[45] */ Signature · 6 lines
1.9.0 -- lvm-devel mailing list lvm-devel at redhat.com https://www.redhat.com/mailman/listinfo/lvm-devel
PATCH 1/1 cmirrord:fix endian issue on s390
Hi Brassow,
Thanks for you quick response.
Quoted 1 line
Quoted 1 line
Quoted 1 line
On 9/9/2014 at 01:54 AM, in message
<[email protected]>, Brassow Jonathan
Quoted 4 lines · <[email protected]> wrote:
Yes, this is the sort of patch I'm looking for. Can you confirm it works for s390 and x86[_64]? That patch looks good to me otherwise.
brassow
I did some tests(lvcreate linear/-m1,mkfs,read/write)on both s390x and x86_64. It works well.
Best regards
Liuhua(lwang at suse.com)
Quoted 82 lines · Liuhua Wang
Quoted 2 lines
Cmirrord has endian bugs, which cause failure to lvcreate a mirrored
lv on s390.
Quoted 1 line
-
data_sizeis uint32, should not use xlate64 to convert, which willcause
data_size0Quoted 2 lines
after xlate.
-request_typeanddata_sizestill used bylocal(v5_data_switch),should convert later.
Quoted 1 line
if
request_typexlate too early, it will causerequest_typejudgeerror;
Quoted 1 line
if
data_sizexlate too early, it will cause coredump in case
DM_ULOG_CLEAR_REGION.Quoted 1 line
- when receiving package in
clog_request_from_network. vp[0] willalways be little endian.
Quoted 1 line
we could use xlate64(vp[0]) == vp[0] to decide if the local nodeis little endian or not.
daemons/cmirrord/compat.c static int v5_endian_to_network(struct clog_request
Quoted 12 lines
---
daemons/cmirrord/compat.c| 9 +++++----1 file changed, 5 insertions(+), 4 deletions(-)daemons/cmirrord/compat.c +0
-0@@ -126,13 +126,14 @@ static int v5_endian_to_network(struct clog_request*rq)
daemons/cmirrord/compat.c static int v5_endian_from_network(struct clog_request
Quoted 17 lines
daemons/cmirrord/compat.c +3
-2u_rq->error =xlate32 (u_rq->error); u_rq->seq =xlate32 (u_rq->seq); - u_rq->request_type =xlate32 (u_rq->request_type); - u_rq->data_size =xlate64 (u_rq->data_size); rq->originator =xlate32 (rq->originator);v5_data_endian_switch (rq,1 ); + u_rq->request_type =xlate32 (u_rq->request_type); + u_rq->data_size =xlate32 (u_rq->data_size); +return size; }@@ -167,7 +168,7 @@ static int v5_endian_from_network(struct clog_request*rq)
daemons/cmirrord/compat.c int clog_request_from_network(void *data, size_t
Quoted 9 lines
daemons/cmirrord/compat.c +1
-1u_rq->error =xlate32 (u_rq->error); u_rq->seq =xlate32 (u_rq->seq); u_rq->request_type =xlate32 (u_rq->request_type); - u_rq->data_size =xlate64 (u_rq->data_size); + u_rq->data_size =xlate32 (u_rq->data_size); rq->originator =xlate32 (rq->originator);@@ -187,7 +188,7 @@ int clog_request_from_network(void *data, size_t
data_len)Quoted 15 lines
daemons/cmirrord/compat.c +1
-1switch (version) {case 5 :/* Upstream */ -if (version == unconverted_version) +if (version == vp[0 ])return 0 ;break ;case 4 :/* RHEL 5.[45] */ Signature · 6 lines
1.9.0 -- lvm-devel mailing list lvm-devel at redhat.com https://www.redhat.com/mailman/listinfo/lvm-devel--
lvm-devel mailing list
lvm-devel at redhat.com
https://www.redhat.com/mailman/listinfo/lvm-devel
PATCH 1/1 cmirrord:fix endian issue on s390
In reply to Liuhua Wangcommitted. I chose the author to be the person who posted the patch.
brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=829e5a40373a2ef1721dc9210350c86c4b9d70f7 Commit: 829e5a40373a2ef1721dc9210350c86c4b9d70f7 Parent: e9216eedfe8189947c506041d8fc9e879fac6d58 Author: Liuhua Wang <[email protected]> AuthorDate: Sat Sep 13 02:08:28 2014 -0500 Committer: Jonathan Brassow <[email protected]> CommitterDate: Mon Sep 15 16:08:35 2014 -0500
Quoted 61 lines · Liuhua Wang
Cmirrord has endian bugs, which cause failure to lvcreate a mirrored lv on s390.
-data_sizeis uint32, should not use xlate64 to convert, which will causedata_size0 after xlate.
-request_typeanddata_sizestill used bylocal(v5_data_switch), should convert later. ifrequest_typexlate too early, it will causerequest_typejudge error; ifdata_sizexlate too early, it will cause coredump in caseDM_ULOG_CLEAR_REGION.
- when receiving package inclog_request_from_network. vp[0] will always be little endian. we could usexlate64(vp[0])== vp[0] to decide if the local node is little endian or not.---
daemons/cmirrord/compat.c| 9 +++++----1 file changed, 5 insertions(+), 4 deletions(-)daemons/cmirrord/compat.c +5
-4@@ -126,13 +126,14 @@ static int v5_endian_to_network(struct clog_request *rq) u_rq->error =xlate32 (u_rq->error); u_rq->seq =xlate32 (u_rq->seq); - u_rq->request_type =xlate32 (u_rq->request_type); - u_rq->data_size =xlate64 (u_rq->data_size); rq->originator =xlate32 (rq->originator);v5_data_endian_switch (rq,1 ); + u_rq->request_type =xlate32 (u_rq->request_type); + u_rq->data_size =xlate32 (u_rq->data_size); +return size; }@@ -167,7 +168,7 @@ static int v5_endian_from_network(struct clog_request *rq) u_rq->error =xlate32 (u_rq->error); u_rq->seq =xlate32 (u_rq->seq); u_rq->request_type =xlate32 (u_rq->request_type); - u_rq->data_size =xlate64 (u_rq->data_size); + u_rq->data_size =xlate32 (u_rq->data_size); rq->originator =xlate32 (rq->originator);@@ -187,7 +188,7 @@ int clog_request_from_network(void *data, size_t data_len)switch (version) {case 5 :/* Upstream */ -if (version == unconverted_version) +if (version == vp[0 ])return 0 ;break ;case 4 :/* RHEL 5.[45] */ Signature · 6 lines
1.9.0 -- lvm-devel mailing list lvm-devel at redhat.com https://www.redhat.com/mailman/listinfo/lvm-devel