@@ -389,38 +389,6 @@ void dlm_put_rsb(struct dlm_rsb *r)
389389 put_rsb (r );
390390}
391391
392- static int pre_rsb_struct (struct dlm_ls * ls )
393- {
394- struct dlm_rsb * r1 , * r2 ;
395- int count = 0 ;
396-
397- spin_lock_bh (& ls -> ls_new_rsb_spin );
398- if (ls -> ls_new_rsb_count > dlm_config .ci_new_rsb_count / 2 ) {
399- spin_unlock_bh (& ls -> ls_new_rsb_spin );
400- return 0 ;
401- }
402- spin_unlock_bh (& ls -> ls_new_rsb_spin );
403-
404- r1 = dlm_allocate_rsb (ls );
405- r2 = dlm_allocate_rsb (ls );
406-
407- spin_lock_bh (& ls -> ls_new_rsb_spin );
408- if (r1 ) {
409- list_add (& r1 -> res_hashchain , & ls -> ls_new_rsb );
410- ls -> ls_new_rsb_count ++ ;
411- }
412- if (r2 ) {
413- list_add (& r2 -> res_hashchain , & ls -> ls_new_rsb );
414- ls -> ls_new_rsb_count ++ ;
415- }
416- count = ls -> ls_new_rsb_count ;
417- spin_unlock_bh (& ls -> ls_new_rsb_spin );
418-
419- if (!count )
420- return - ENOMEM ;
421- return 0 ;
422- }
423-
424392/* connected with timer_delete_sync() in dlm_ls_stop() to stop
425393 * new timers when recovery is triggered and don't run them
426394 * again until a dlm_timer_resume() tries it again.
@@ -652,22 +620,10 @@ static int get_rsb_struct(struct dlm_ls *ls, const void *name, int len,
652620 struct dlm_rsb * * r_ret )
653621{
654622 struct dlm_rsb * r ;
655- int count ;
656623
657- spin_lock_bh (& ls -> ls_new_rsb_spin );
658- if (list_empty (& ls -> ls_new_rsb )) {
659- count = ls -> ls_new_rsb_count ;
660- spin_unlock_bh (& ls -> ls_new_rsb_spin );
661- log_debug (ls , "find_rsb retry %d %d %s" ,
662- count , dlm_config .ci_new_rsb_count ,
663- (const char * )name );
664- return - EAGAIN ;
665- }
666-
667- r = list_first_entry (& ls -> ls_new_rsb , struct dlm_rsb , res_hashchain );
668- list_del (& r -> res_hashchain );
669- ls -> ls_new_rsb_count -- ;
670- spin_unlock_bh (& ls -> ls_new_rsb_spin );
624+ r = dlm_allocate_rsb (ls );
625+ if (!r )
626+ return - ENOMEM ;
671627
672628 r -> res_ls = ls ;
673629 r -> res_length = len ;
@@ -792,13 +748,6 @@ static int find_rsb_dir(struct dlm_ls *ls, const void *name, int len,
792748 }
793749
794750 retry :
795- if (create ) {
796- error = pre_rsb_struct (ls );
797- if (error < 0 )
798- goto out ;
799- }
800-
801- retry_lookup :
802751
803752 /* check if the rsb is in keep state under read lock - likely path */
804753 read_lock_bh (& ls -> ls_rsbtbl_lock );
@@ -832,7 +781,7 @@ static int find_rsb_dir(struct dlm_ls *ls, const void *name, int len,
832781 if (!error ) {
833782 if (!rsb_flag (r , RSB_TOSS )) {
834783 write_unlock_bh (& ls -> ls_rsbtbl_lock );
835- goto retry_lookup ;
784+ goto retry ;
836785 }
837786 } else {
838787 write_unlock_bh (& ls -> ls_rsbtbl_lock );
@@ -898,9 +847,7 @@ static int find_rsb_dir(struct dlm_ls *ls, const void *name, int len,
898847 goto out ;
899848
900849 error = get_rsb_struct (ls , name , len , & r );
901- if (error == - EAGAIN )
902- goto retry ;
903- if (error )
850+ if (WARN_ON_ONCE (error ))
904851 goto out ;
905852
906853 r -> res_hash = hash ;
@@ -952,7 +899,7 @@ static int find_rsb_dir(struct dlm_ls *ls, const void *name, int len,
952899 */
953900 write_unlock_bh (& ls -> ls_rsbtbl_lock );
954901 dlm_free_rsb (r );
955- goto retry_lookup ;
902+ goto retry ;
956903 } else if (!error ) {
957904 list_add (& r -> res_rsbs_list , & ls -> ls_keep );
958905 }
@@ -976,11 +923,6 @@ static int find_rsb_nodir(struct dlm_ls *ls, const void *name, int len,
976923 int error ;
977924
978925 retry :
979- error = pre_rsb_struct (ls );
980- if (error < 0 )
981- goto out ;
982-
983- retry_lookup :
984926
985927 /* check if the rsb is in keep state under read lock - likely path */
986928 read_lock_bh (& ls -> ls_rsbtbl_lock );
@@ -1015,7 +957,7 @@ static int find_rsb_nodir(struct dlm_ls *ls, const void *name, int len,
1015957 if (!error ) {
1016958 if (!rsb_flag (r , RSB_TOSS )) {
1017959 write_unlock_bh (& ls -> ls_rsbtbl_lock );
1018- goto retry_lookup ;
960+ goto retry ;
1019961 }
1020962 } else {
1021963 write_unlock_bh (& ls -> ls_rsbtbl_lock );
@@ -1070,10 +1012,7 @@ static int find_rsb_nodir(struct dlm_ls *ls, const void *name, int len,
10701012 */
10711013
10721014 error = get_rsb_struct (ls , name , len , & r );
1073- if (error == - EAGAIN ) {
1074- goto retry ;
1075- }
1076- if (error )
1015+ if (WARN_ON_ONCE (error ))
10771016 goto out ;
10781017
10791018 r -> res_hash = hash ;
@@ -1090,7 +1029,7 @@ static int find_rsb_nodir(struct dlm_ls *ls, const void *name, int len,
10901029 */
10911030 write_unlock_bh (& ls -> ls_rsbtbl_lock );
10921031 dlm_free_rsb (r );
1093- goto retry_lookup ;
1032+ goto retry ;
10941033 } else if (!error ) {
10951034 list_add (& r -> res_rsbs_list , & ls -> ls_keep );
10961035 }
@@ -1304,11 +1243,6 @@ int dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *name,
13041243 }
13051244
13061245 retry :
1307- error = pre_rsb_struct (ls );
1308- if (error < 0 )
1309- return error ;
1310-
1311- retry_lookup :
13121246
13131247 /* check if the rsb is in keep state under read lock - likely path */
13141248 read_lock_bh (& ls -> ls_rsbtbl_lock );
@@ -1354,7 +1288,7 @@ int dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *name,
13541288 /* something as changed, very unlikely but
13551289 * try again
13561290 */
1357- goto retry_lookup ;
1291+ goto retry ;
13581292 }
13591293 } else {
13601294 write_unlock_bh (& ls -> ls_rsbtbl_lock );
@@ -1376,9 +1310,7 @@ int dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *name,
13761310
13771311 not_found :
13781312 error = get_rsb_struct (ls , name , len , & r );
1379- if (error == - EAGAIN )
1380- goto retry ;
1381- if (error )
1313+ if (WARN_ON_ONCE (error ))
13821314 goto out ;
13831315
13841316 r -> res_hash = hash ;
@@ -1395,7 +1327,7 @@ int dlm_master_lookup(struct dlm_ls *ls, int from_nodeid, const char *name,
13951327 */
13961328 write_unlock_bh (& ls -> ls_rsbtbl_lock );
13971329 dlm_free_rsb (r );
1398- goto retry_lookup ;
1330+ goto retry ;
13991331 } else if (error ) {
14001332 write_unlock_bh (& ls -> ls_rsbtbl_lock );
14011333 /* should never happen */
0 commit comments