@@ -1407,7 +1407,6 @@ static int add_to_waiters(struct dlm_lkb *lkb, int mstype, int to_nodeid)
1407
1407
{
1408
1408
struct dlm_ls * ls = lkb -> lkb_resource -> res_ls ;
1409
1409
int error = 0 ;
1410
- int wc ;
1411
1410
1412
1411
mutex_lock (& ls -> ls_waiters_mutex );
1413
1412
@@ -1429,17 +1428,20 @@ static int add_to_waiters(struct dlm_lkb *lkb, int mstype, int to_nodeid)
1429
1428
error = - EBUSY ;
1430
1429
goto out ;
1431
1430
}
1432
- wc = atomic_inc_return ( & lkb -> lkb_wait_count ) ;
1431
+ lkb -> lkb_wait_count ++ ;
1433
1432
hold_lkb (lkb );
1434
1433
1435
1434
log_debug (ls , "addwait %x cur %d overlap %d count %d f %x" ,
1436
- lkb -> lkb_id , lkb -> lkb_wait_type , mstype , wc ,
1437
- dlm_iflags_val (lkb ));
1435
+ lkb -> lkb_id , lkb -> lkb_wait_type , mstype ,
1436
+ lkb -> lkb_wait_count , dlm_iflags_val (lkb ));
1438
1437
goto out ;
1439
1438
}
1440
1439
1441
- wc = atomic_fetch_inc (& lkb -> lkb_wait_count );
1442
- DLM_ASSERT (!wc , dlm_print_lkb (lkb ); printk ("wait_count %d\n" , wc ););
1440
+ DLM_ASSERT (!lkb -> lkb_wait_count ,
1441
+ dlm_print_lkb (lkb );
1442
+ printk ("wait_count %d\n" , lkb -> lkb_wait_count ););
1443
+
1444
+ lkb -> lkb_wait_count ++ ;
1443
1445
lkb -> lkb_wait_type = mstype ;
1444
1446
lkb -> lkb_wait_nodeid = to_nodeid ; /* for debugging */
1445
1447
hold_lkb (lkb );
@@ -1502,7 +1504,7 @@ static int _remove_from_waiters(struct dlm_lkb *lkb, int mstype,
1502
1504
log_debug (ls , "remwait %x convert_reply zap overlap_cancel" ,
1503
1505
lkb -> lkb_id );
1504
1506
lkb -> lkb_wait_type = 0 ;
1505
- atomic_dec ( & lkb -> lkb_wait_count ) ;
1507
+ lkb -> lkb_wait_count -- ;
1506
1508
unhold_lkb (lkb );
1507
1509
goto out_del ;
1508
1510
}
@@ -1529,15 +1531,16 @@ static int _remove_from_waiters(struct dlm_lkb *lkb, int mstype,
1529
1531
if (overlap_done && lkb -> lkb_wait_type ) {
1530
1532
log_error (ls , "remwait error %x reply %d wait_type %d overlap" ,
1531
1533
lkb -> lkb_id , mstype , lkb -> lkb_wait_type );
1532
- atomic_dec ( & lkb -> lkb_wait_count ) ;
1534
+ lkb -> lkb_wait_count -- ;
1533
1535
unhold_lkb (lkb );
1534
1536
lkb -> lkb_wait_type = 0 ;
1535
1537
}
1536
1538
1537
- DLM_ASSERT (atomic_read ( & lkb -> lkb_wait_count ) , dlm_print_lkb (lkb ););
1539
+ DLM_ASSERT (lkb -> lkb_wait_count , dlm_print_lkb (lkb ););
1538
1540
1539
1541
clear_bit (DLM_IFL_RESEND_BIT , & lkb -> lkb_iflags );
1540
- if (atomic_dec_and_test (& lkb -> lkb_wait_count ))
1542
+ lkb -> lkb_wait_count -- ;
1543
+ if (!lkb -> lkb_wait_count )
1541
1544
list_del_init (& lkb -> lkb_wait_reply );
1542
1545
unhold_lkb (lkb );
1543
1546
return 0 ;
@@ -2666,7 +2669,7 @@ static int validate_lock_args(struct dlm_ls *ls, struct dlm_lkb *lkb,
2666
2669
goto out ;
2667
2670
2668
2671
/* lock not allowed if there's any op in progress */
2669
- if (lkb -> lkb_wait_type || atomic_read ( & lkb -> lkb_wait_count ) )
2672
+ if (lkb -> lkb_wait_type || lkb -> lkb_wait_count )
2670
2673
goto out ;
2671
2674
2672
2675
if (is_overlap (lkb ))
@@ -2728,7 +2731,7 @@ static int validate_unlock_args(struct dlm_lkb *lkb, struct dlm_args *args)
2728
2731
2729
2732
/* normal unlock not allowed if there's any op in progress */
2730
2733
if (!(args -> flags & (DLM_LKF_CANCEL | DLM_LKF_FORCEUNLOCK )) &&
2731
- (lkb -> lkb_wait_type || atomic_read ( & lkb -> lkb_wait_count ) ))
2734
+ (lkb -> lkb_wait_type || lkb -> lkb_wait_count ))
2732
2735
goto out ;
2733
2736
2734
2737
/* an lkb may be waiting for an rsb lookup to complete where the
@@ -5070,9 +5073,10 @@ int dlm_recover_waiters_post(struct dlm_ls *ls)
5070
5073
/* drop all wait_count references we still
5071
5074
* hold a reference for this iteration.
5072
5075
*/
5073
- while (!atomic_dec_and_test (& lkb -> lkb_wait_count ))
5076
+ while (lkb -> lkb_wait_count ) {
5077
+ lkb -> lkb_wait_count -- ;
5074
5078
unhold_lkb (lkb );
5075
-
5079
+ }
5076
5080
mutex_lock (& ls -> ls_waiters_mutex );
5077
5081
list_del_init (& lkb -> lkb_wait_reply );
5078
5082
mutex_unlock (& ls -> ls_waiters_mutex );
0 commit comments