@@ -1590,28 +1590,9 @@ static inline bool needs_demote(struct gfs2_glock *gl)
1590
1590
static void __gfs2_glock_dq (struct gfs2_holder * gh )
1591
1591
{
1592
1592
struct gfs2_glock * gl = gh -> gh_gl ;
1593
- struct gfs2_sbd * sdp = gl -> gl_name .ln_sbd ;
1594
1593
unsigned delay = 0 ;
1595
1594
int fast_path = 0 ;
1596
1595
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
-
1615
1596
/*
1616
1597
* This holder should not be cached, so mark it for demote.
1617
1598
* Note: this should be done before the check for needs_demote
@@ -1654,6 +1635,7 @@ static void __gfs2_glock_dq(struct gfs2_holder *gh)
1654
1635
void gfs2_glock_dq (struct gfs2_holder * gh )
1655
1636
{
1656
1637
struct gfs2_glock * gl = gh -> gh_gl ;
1638
+ struct gfs2_sbd * sdp = gl -> gl_name .ln_sbd ;
1657
1639
1658
1640
spin_lock (& gl -> gl_lockref .lock );
1659
1641
if (!gfs2_holder_queued (gh )) {
@@ -1663,6 +1645,7 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
1663
1645
*/
1664
1646
goto out ;
1665
1647
}
1648
+
1666
1649
if (list_is_first (& gh -> gh_list , & gl -> gl_holders ) &&
1667
1650
!test_bit (HIF_HOLDER , & gh -> gh_iflags )) {
1668
1651
spin_unlock (& gl -> gl_lockref .lock );
@@ -1671,6 +1654,24 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
1671
1654
spin_lock (& gl -> gl_lockref .lock );
1672
1655
}
1673
1656
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
+
1674
1675
__gfs2_glock_dq (gh );
1675
1676
out :
1676
1677
spin_unlock (& gl -> gl_lockref .lock );
0 commit comments