@@ -1590,28 +1590,9 @@ static inline bool needs_demote(struct gfs2_glock *gl)
15901590static void __gfs2_glock_dq (struct gfs2_holder * gh )
15911591{
15921592 struct gfs2_glock * gl = gh -> gh_gl ;
1593- struct gfs2_sbd * sdp = gl -> gl_name .ln_sbd ;
15941593 unsigned delay = 0 ;
15951594 int fast_path = 0 ;
15961595
1597- /*
1598- * If we're in the process of file system withdraw, we cannot just
1599- * dequeue any glocks until our journal is recovered, lest we introduce
1600- * file system corruption. We need two exceptions to this rule: We need
1601- * to allow unlocking of nondisk glocks and the glock for our own
1602- * journal that needs recovery.
1603- */
1604- if (test_bit (SDF_WITHDRAW_RECOVERY , & sdp -> sd_flags ) &&
1605- glock_blocked_by_withdraw (gl ) &&
1606- gh -> gh_gl != sdp -> sd_jinode_gl ) {
1607- sdp -> sd_glock_dqs_held ++ ;
1608- spin_unlock (& gl -> gl_lockref .lock );
1609- might_sleep ();
1610- wait_on_bit (& sdp -> sd_flags , SDF_WITHDRAW_RECOVERY ,
1611- TASK_UNINTERRUPTIBLE );
1612- spin_lock (& gl -> gl_lockref .lock );
1613- }
1614-
16151596 /*
16161597 * This holder should not be cached, so mark it for demote.
16171598 * Note: this should be done before the check for needs_demote
@@ -1654,6 +1635,7 @@ static void __gfs2_glock_dq(struct gfs2_holder *gh)
16541635void gfs2_glock_dq (struct gfs2_holder * gh )
16551636{
16561637 struct gfs2_glock * gl = gh -> gh_gl ;
1638+ struct gfs2_sbd * sdp = gl -> gl_name .ln_sbd ;
16571639
16581640 spin_lock (& gl -> gl_lockref .lock );
16591641 if (!gfs2_holder_queued (gh )) {
@@ -1663,6 +1645,7 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
16631645 */
16641646 goto out ;
16651647 }
1648+
16661649 if (list_is_first (& gh -> gh_list , & gl -> gl_holders ) &&
16671650 !test_bit (HIF_HOLDER , & gh -> gh_iflags )) {
16681651 spin_unlock (& gl -> gl_lockref .lock );
@@ -1671,6 +1654,24 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
16711654 spin_lock (& gl -> gl_lockref .lock );
16721655 }
16731656
1657+ /*
1658+ * If we're in the process of file system withdraw, we cannot just
1659+ * dequeue any glocks until our journal is recovered, lest we introduce
1660+ * file system corruption. We need two exceptions to this rule: We need
1661+ * to allow unlocking of nondisk glocks and the glock for our own
1662+ * journal that needs recovery.
1663+ */
1664+ if (test_bit (SDF_WITHDRAW_RECOVERY , & sdp -> sd_flags ) &&
1665+ glock_blocked_by_withdraw (gl ) &&
1666+ gh -> gh_gl != sdp -> sd_jinode_gl ) {
1667+ sdp -> sd_glock_dqs_held ++ ;
1668+ spin_unlock (& gl -> gl_lockref .lock );
1669+ might_sleep ();
1670+ wait_on_bit (& sdp -> sd_flags , SDF_WITHDRAW_RECOVERY ,
1671+ TASK_UNINTERRUPTIBLE );
1672+ spin_lock (& gl -> gl_lockref .lock );
1673+ }
1674+
16741675 __gfs2_glock_dq (gh );
16751676out :
16761677 spin_unlock (& gl -> gl_lockref .lock );
0 commit comments