@@ -494,48 +494,47 @@ __acquires(&gl->gl_lockref.lock)
494494 list_for_each_entry_safe (gh , tmp , & gl -> gl_holders , gh_list ) {
495495 if (!test_bit (HIF_WAIT , & gh -> gh_iflags ))
496496 continue ;
497- if (may_grant (gl , first_gh , gh )) {
498- if (!incompat_holders_demoted ) {
499- demote_incompat_holders (gl , first_gh );
500- incompat_holders_demoted = true;
501- first_gh = gh ;
502- }
503- if (gh -> gh_list .prev == & gl -> gl_holders &&
504- glops -> go_instantiate ) {
505- if (!(gh -> gh_flags & GL_SKIP )) {
506- spin_unlock (& gl -> gl_lockref .lock );
507- /* FIXME: eliminate this eventually */
508- ret = glops -> go_instantiate (gh );
509- spin_lock (& gl -> gl_lockref .lock );
510- if (ret ) {
511- if (ret == 1 )
512- return 2 ;
513- gh -> gh_error = ret ;
514- list_del_init (& gh -> gh_list );
515- trace_gfs2_glock_queue (gh , 0 );
516- gfs2_holder_wake (gh );
517- goto restart ;
518- }
497+ if (!may_grant (gl , first_gh , gh )) {
498+ /*
499+ * If we get here, it means we may not grant this holder for
500+ * some reason. If this holder is the head of the list, it
501+ * means we have a blocked holder at the head, so return 1.
502+ */
503+ if (gh -> gh_list .prev == & gl -> gl_holders )
504+ return 1 ;
505+ do_error (gl , 0 );
506+ break ;
507+ }
508+ if (!incompat_holders_demoted ) {
509+ demote_incompat_holders (gl , first_gh );
510+ incompat_holders_demoted = true;
511+ first_gh = gh ;
512+ }
513+ if (gh -> gh_list .prev == & gl -> gl_holders &&
514+ glops -> go_instantiate ) {
515+ if (!(gh -> gh_flags & GL_SKIP )) {
516+ spin_unlock (& gl -> gl_lockref .lock );
517+ /* FIXME: eliminate this eventually */
518+ ret = glops -> go_instantiate (gh );
519+ spin_lock (& gl -> gl_lockref .lock );
520+ if (ret ) {
521+ if (ret == 1 )
522+ return 2 ;
523+ gh -> gh_error = ret ;
524+ list_del_init (& gh -> gh_list );
525+ trace_gfs2_glock_queue (gh , 0 );
526+ gfs2_holder_wake (gh );
527+ goto restart ;
519528 }
520- set_bit (HIF_HOLDER , & gh -> gh_iflags );
521- trace_gfs2_promote (gh );
522- gfs2_holder_wake (gh );
523- goto restart ;
524529 }
525530 set_bit (HIF_HOLDER , & gh -> gh_iflags );
526531 trace_gfs2_promote (gh );
527532 gfs2_holder_wake (gh );
528- continue ;
533+ goto restart ;
529534 }
530- /*
531- * If we get here, it means we may not grant this holder for
532- * some reason. If this holder is the head of the list, it
533- * means we have a blocked holder at the head, so return 1.
534- */
535- if (gh -> gh_list .prev == & gl -> gl_holders )
536- return 1 ;
537- do_error (gl , 0 );
538- break ;
535+ set_bit (HIF_HOLDER , & gh -> gh_iflags );
536+ trace_gfs2_promote (gh );
537+ gfs2_holder_wake (gh );
539538 }
540539 return 0 ;
541540}
0 commit comments