diff options
Diffstat (limited to 'fs/xfs/xfs_ialloc.c')
-rw-r--r-- | fs/xfs/xfs_ialloc.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index 21e37b55f7e5..5aceb3f8ecd6 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
@@ -962,23 +962,22 @@ xfs_dialloc( | |||
962 | if (!pag->pagi_freecount && !okalloc) | 962 | if (!pag->pagi_freecount && !okalloc) |
963 | goto nextag; | 963 | goto nextag; |
964 | 964 | ||
965 | /* | ||
966 | * Then read in the AGI buffer and recheck with the AGI buffer | ||
967 | * lock held. | ||
968 | */ | ||
965 | error = xfs_ialloc_read_agi(mp, tp, agno, &agbp); | 969 | error = xfs_ialloc_read_agi(mp, tp, agno, &agbp); |
966 | if (error) | 970 | if (error) |
967 | goto out_error; | 971 | goto out_error; |
968 | 972 | ||
969 | /* | ||
970 | * Once the AGI has been read in we have to recheck | ||
971 | * pagi_freecount with the AGI buffer lock held. | ||
972 | */ | ||
973 | if (pag->pagi_freecount) { | 973 | if (pag->pagi_freecount) { |
974 | xfs_perag_put(pag); | 974 | xfs_perag_put(pag); |
975 | goto out_alloc; | 975 | goto out_alloc; |
976 | } | 976 | } |
977 | 977 | ||
978 | if (!okalloc) { | 978 | if (!okalloc) |
979 | xfs_trans_brelse(tp, agbp); | 979 | goto nextag_relse_buffer; |
980 | goto nextag; | 980 | |
981 | } | ||
982 | 981 | ||
983 | error = xfs_ialloc_ag_alloc(tp, agbp, &ialloced); | 982 | error = xfs_ialloc_ag_alloc(tp, agbp, &ialloced); |
984 | if (error) { | 983 | if (error) { |
@@ -1007,6 +1006,8 @@ xfs_dialloc( | |||
1007 | return 0; | 1006 | return 0; |
1008 | } | 1007 | } |
1009 | 1008 | ||
1009 | nextag_relse_buffer: | ||
1010 | xfs_trans_brelse(tp, agbp); | ||
1010 | nextag: | 1011 | nextag: |
1011 | xfs_perag_put(pag); | 1012 | xfs_perag_put(pag); |
1012 | if (++agno == mp->m_sb.sb_agcount) | 1013 | if (++agno == mp->m_sb.sb_agcount) |