@@ -40,10 +40,10 @@ static void _create_rcom(struct dlm_ls *ls, int to_nodeid, int type, int len,
40
40
rc -> rc_header .h_length = cpu_to_le16 (mb_len );
41
41
rc -> rc_header .h_cmd = DLM_RCOM ;
42
42
43
- rc -> rc_type = type ;
43
+ rc -> rc_type = cpu_to_le32 ( type ) ;
44
44
45
45
spin_lock (& ls -> ls_recover_lock );
46
- rc -> rc_seq = ls -> ls_recover_seq ;
46
+ rc -> rc_seq = cpu_to_le64 ( ls -> ls_recover_seq ) ;
47
47
spin_unlock (& ls -> ls_recover_lock );
48
48
49
49
* rc_ret = rc ;
@@ -91,13 +91,11 @@ static int create_rcom_stateless(struct dlm_ls *ls, int to_nodeid, int type,
91
91
92
92
static void send_rcom (struct dlm_mhandle * mh , struct dlm_rcom * rc )
93
93
{
94
- dlm_rcom_out (rc );
95
94
dlm_midcomms_commit_mhandle (mh );
96
95
}
97
96
98
97
static void send_rcom_stateless (struct dlm_msg * msg , struct dlm_rcom * rc )
99
98
{
100
- dlm_rcom_out (rc );
101
99
dlm_lowcomms_commit_msg (msg );
102
100
dlm_lowcomms_put_msg (msg );
103
101
}
@@ -145,10 +143,10 @@ static int check_rcom_config(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
145
143
return 0 ;
146
144
}
147
145
148
- static void allow_sync_reply (struct dlm_ls * ls , uint64_t * new_seq )
146
+ static void allow_sync_reply (struct dlm_ls * ls , __le64 * new_seq )
149
147
{
150
148
spin_lock (& ls -> ls_rcom_spin );
151
- * new_seq = ++ ls -> ls_rcom_seq ;
149
+ * new_seq = cpu_to_le64 ( ++ ls -> ls_rcom_seq ) ;
152
150
set_bit (LSFL_RCOM_WAIT , & ls -> ls_flags );
153
151
spin_unlock (& ls -> ls_rcom_spin );
154
152
}
@@ -182,7 +180,7 @@ int dlm_rcom_status(struct dlm_ls *ls, int nodeid, uint32_t status_flags)
182
180
183
181
if (nodeid == dlm_our_nodeid ()) {
184
182
rc = ls -> ls_recover_buf ;
185
- rc -> rc_result = dlm_recover_status (ls );
183
+ rc -> rc_result = cpu_to_le32 ( dlm_recover_status (ls ) );
186
184
goto out ;
187
185
}
188
186
@@ -208,7 +206,7 @@ int dlm_rcom_status(struct dlm_ls *ls, int nodeid, uint32_t status_flags)
208
206
209
207
rc = ls -> ls_recover_buf ;
210
208
211
- if (rc -> rc_result == - ESRCH ) {
209
+ if (rc -> rc_result == cpu_to_le32 ( - ESRCH ) ) {
212
210
/* we pretend the remote lockspace exists with 0 status */
213
211
log_debug (ls , "remote node %d not ready" , nodeid );
214
212
rc -> rc_result = 0 ;
@@ -259,7 +257,7 @@ static void receive_rcom_status(struct dlm_ls *ls, struct dlm_rcom *rc_in)
259
257
260
258
rc -> rc_id = rc_in -> rc_id ;
261
259
rc -> rc_seq_reply = rc_in -> rc_seq ;
262
- rc -> rc_result = status ;
260
+ rc -> rc_result = cpu_to_le32 ( status ) ;
263
261
264
262
set_rcom_config (ls , (struct rcom_config * )rc -> rc_buf , num_slots );
265
263
@@ -287,11 +285,11 @@ static void receive_sync_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in)
287
285
{
288
286
spin_lock (& ls -> ls_rcom_spin );
289
287
if (!test_bit (LSFL_RCOM_WAIT , & ls -> ls_flags ) ||
290
- rc_in -> rc_id != ls -> ls_rcom_seq ) {
288
+ le64_to_cpu ( rc_in -> rc_id ) != ls -> ls_rcom_seq ) {
291
289
log_debug (ls , "reject reply %d from %d seq %llx expect %llx" ,
292
- rc_in -> rc_type ,
290
+ le32_to_cpu ( rc_in -> rc_type ) ,
293
291
le32_to_cpu (rc_in -> rc_header .h_nodeid ),
294
- (unsigned long long )rc_in -> rc_id ,
292
+ (unsigned long long )le64_to_cpu ( rc_in -> rc_id ) ,
295
293
(unsigned long long )ls -> ls_rcom_seq );
296
294
goto out ;
297
295
}
@@ -367,7 +365,7 @@ int dlm_send_rcom_lookup(struct dlm_rsb *r, int dir_nodeid)
367
365
if (error )
368
366
goto out ;
369
367
memcpy (rc -> rc_buf , r -> res_name , r -> res_length );
370
- rc -> rc_id = ( unsigned long ) r -> res_id ;
368
+ rc -> rc_id = cpu_to_le64 ( r -> res_id ) ;
371
369
372
370
send_rcom (mh , rc );
373
371
out :
@@ -383,7 +381,7 @@ static void receive_rcom_lookup(struct dlm_ls *ls, struct dlm_rcom *rc_in)
383
381
sizeof (struct dlm_rcom );
384
382
385
383
/* Old code would send this special id to trigger a debug dump. */
386
- if (rc_in -> rc_id == 0xFFFFFFFF ) {
384
+ if (rc_in -> rc_id == cpu_to_le64 ( 0xFFFFFFFF ) ) {
387
385
log_error (ls , "receive_rcom_lookup dump from %d" , nodeid );
388
386
dlm_dump_rsb_name (ls , rc_in -> rc_buf , len );
389
387
return ;
@@ -397,7 +395,7 @@ static void receive_rcom_lookup(struct dlm_ls *ls, struct dlm_rcom *rc_in)
397
395
DLM_LU_RECOVER_MASTER , & ret_nodeid , NULL );
398
396
if (error )
399
397
ret_nodeid = error ;
400
- rc -> rc_result = ret_nodeid ;
398
+ rc -> rc_result = cpu_to_le32 ( ret_nodeid ) ;
401
399
rc -> rc_id = rc_in -> rc_id ;
402
400
rc -> rc_seq_reply = rc_in -> rc_seq ;
403
401
@@ -456,7 +454,7 @@ int dlm_send_rcom_lock(struct dlm_rsb *r, struct dlm_lkb *lkb)
456
454
457
455
rl = (struct rcom_lock * ) rc -> rc_buf ;
458
456
pack_rcom_lock (r , lkb , rl );
459
- rc -> rc_id = ( unsigned long ) r ;
457
+ rc -> rc_id = cpu_to_le64 ( r ) ;
460
458
461
459
send_rcom (mh , rc );
462
460
out :
@@ -510,15 +508,14 @@ int dlm_send_ls_not_ready(int nodeid, struct dlm_rcom *rc_in)
510
508
rc -> rc_header .h_length = cpu_to_le16 (mb_len );
511
509
rc -> rc_header .h_cmd = DLM_RCOM ;
512
510
513
- rc -> rc_type = DLM_RCOM_STATUS_REPLY ;
511
+ rc -> rc_type = cpu_to_le32 ( DLM_RCOM_STATUS_REPLY ) ;
514
512
rc -> rc_id = rc_in -> rc_id ;
515
513
rc -> rc_seq_reply = rc_in -> rc_seq ;
516
- rc -> rc_result = - ESRCH ;
514
+ rc -> rc_result = cpu_to_le32 ( - ESRCH ) ;
517
515
518
516
rf = (struct rcom_config * ) rc -> rc_buf ;
519
517
rf -> rf_lvblen = cpu_to_le32 (~0U );
520
518
521
- dlm_rcom_out (rc );
522
519
dlm_midcomms_commit_mhandle (mh );
523
520
524
521
return 0 ;
@@ -577,27 +574,27 @@ void dlm_receive_rcom(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
577
574
uint64_t seq ;
578
575
579
576
switch (rc -> rc_type ) {
580
- case DLM_RCOM_STATUS_REPLY :
577
+ case cpu_to_le32 ( DLM_RCOM_STATUS_REPLY ) :
581
578
reply = 1 ;
582
579
break ;
583
- case DLM_RCOM_NAMES :
580
+ case cpu_to_le32 ( DLM_RCOM_NAMES ) :
584
581
names = 1 ;
585
582
break ;
586
- case DLM_RCOM_NAMES_REPLY :
583
+ case cpu_to_le32 ( DLM_RCOM_NAMES_REPLY ) :
587
584
names = 1 ;
588
585
reply = 1 ;
589
586
break ;
590
- case DLM_RCOM_LOOKUP :
587
+ case cpu_to_le32 ( DLM_RCOM_LOOKUP ) :
591
588
lookup = 1 ;
592
589
break ;
593
- case DLM_RCOM_LOOKUP_REPLY :
590
+ case cpu_to_le32 ( DLM_RCOM_LOOKUP_REPLY ) :
594
591
lookup = 1 ;
595
592
reply = 1 ;
596
593
break ;
597
- case DLM_RCOM_LOCK :
594
+ case cpu_to_le32 ( DLM_RCOM_LOCK ) :
598
595
lock = 1 ;
599
596
break ;
600
- case DLM_RCOM_LOCK_REPLY :
597
+ case cpu_to_le32 ( DLM_RCOM_LOCK_REPLY ) :
601
598
lock = 1 ;
602
599
reply = 1 ;
603
600
break ;
@@ -609,10 +606,10 @@ void dlm_receive_rcom(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
609
606
seq = ls -> ls_recover_seq ;
610
607
spin_unlock (& ls -> ls_recover_lock );
611
608
612
- if (stop && (rc -> rc_type != DLM_RCOM_STATUS ))
609
+ if (stop && (rc -> rc_type != cpu_to_le32 ( DLM_RCOM_STATUS ) ))
613
610
goto ignore ;
614
611
615
- if (reply && (rc -> rc_seq_reply != seq ))
612
+ if (reply && (le64_to_cpu ( rc -> rc_seq_reply ) != seq ))
616
613
goto ignore ;
617
614
618
615
if (!(status & DLM_RS_NODES ) && (names || lookup || lock ))
@@ -622,59 +619,60 @@ void dlm_receive_rcom(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
622
619
goto ignore ;
623
620
624
621
switch (rc -> rc_type ) {
625
- case DLM_RCOM_STATUS :
622
+ case cpu_to_le32 ( DLM_RCOM_STATUS ) :
626
623
receive_rcom_status (ls , rc );
627
624
break ;
628
625
629
- case DLM_RCOM_NAMES :
626
+ case cpu_to_le32 ( DLM_RCOM_NAMES ) :
630
627
receive_rcom_names (ls , rc );
631
628
break ;
632
629
633
- case DLM_RCOM_LOOKUP :
630
+ case cpu_to_le32 ( DLM_RCOM_LOOKUP ) :
634
631
receive_rcom_lookup (ls , rc );
635
632
break ;
636
633
637
- case DLM_RCOM_LOCK :
634
+ case cpu_to_le32 ( DLM_RCOM_LOCK ) :
638
635
if (le16_to_cpu (rc -> rc_header .h_length ) < lock_size )
639
636
goto Eshort ;
640
637
receive_rcom_lock (ls , rc );
641
638
break ;
642
639
643
- case DLM_RCOM_STATUS_REPLY :
640
+ case cpu_to_le32 ( DLM_RCOM_STATUS_REPLY ) :
644
641
receive_sync_reply (ls , rc );
645
642
break ;
646
643
647
- case DLM_RCOM_NAMES_REPLY :
644
+ case cpu_to_le32 ( DLM_RCOM_NAMES_REPLY ) :
648
645
receive_sync_reply (ls , rc );
649
646
break ;
650
647
651
- case DLM_RCOM_LOOKUP_REPLY :
648
+ case cpu_to_le32 ( DLM_RCOM_LOOKUP_REPLY ) :
652
649
receive_rcom_lookup_reply (ls , rc );
653
650
break ;
654
651
655
- case DLM_RCOM_LOCK_REPLY :
652
+ case cpu_to_le32 ( DLM_RCOM_LOCK_REPLY ) :
656
653
if (le16_to_cpu (rc -> rc_header .h_length ) < lock_size )
657
654
goto Eshort ;
658
655
dlm_recover_process_copy (ls , rc );
659
656
break ;
660
657
661
658
default :
662
- log_error (ls , "receive_rcom bad type %d" , rc -> rc_type );
659
+ log_error (ls , "receive_rcom bad type %d" ,
660
+ le32_to_cpu (rc -> rc_type ));
663
661
}
664
662
return ;
665
663
666
664
ignore :
667
665
log_limit (ls , "dlm_receive_rcom ignore msg %d "
668
666
"from %d %llu %llu recover seq %llu sts %x gen %u" ,
669
- rc -> rc_type ,
667
+ le32_to_cpu ( rc -> rc_type ) ,
670
668
nodeid ,
671
- (unsigned long long )rc -> rc_seq ,
672
- (unsigned long long )rc -> rc_seq_reply ,
669
+ (unsigned long long )le64_to_cpu ( rc -> rc_seq ) ,
670
+ (unsigned long long )le64_to_cpu ( rc -> rc_seq_reply ) ,
673
671
(unsigned long long )seq ,
674
672
status , ls -> ls_generation );
675
673
return ;
676
674
Eshort :
677
675
log_error (ls , "recovery message %d from %d is too short" ,
678
- rc -> rc_type , nodeid );
676
+ le32_to_cpu ( rc -> rc_type ) , nodeid );
679
677
}
680
678
0 commit comments