[GFS2] Ensure journal file cache is flushed after recovery
[cascardo/linux.git] / fs / gfs2 / log.c
index f49a12e..00ab6c0 100644 (file)
@@ -83,11 +83,6 @@ static void gfs2_ail1_start_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
 
                        gfs2_assert(sdp, bd->bd_ail == ai);
 
-                       if (!bh){
-                               list_move(&bd->bd_ail_st_list, &ai->ai_ail2_list);
-                                continue;
-                        }
-
                        if (!buffer_busy(bh)) {
                                if (!buffer_uptodate(bh)) {
                                        gfs2_log_unlock(sdp);
@@ -130,11 +125,6 @@ static int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai, int fl
                                         bd_ail_st_list) {
                bh = bd->bd_bh;
 
-               if (!bh){
-                       list_move(&bd->bd_ail_st_list, &ai->ai_ail2_list);
-                       continue;
-               }
-
                gfs2_assert(sdp, bd->bd_ail == ai);
 
                if (buffer_busy(bh)) {
@@ -155,13 +145,14 @@ static int gfs2_ail1_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai, int fl
 
 static void gfs2_ail1_start(struct gfs2_sbd *sdp, int flags)
 {
-       struct list_head *head = &sdp->sd_ail1_list;
+       struct list_head *head;
        u64 sync_gen;
        struct list_head *first;
        struct gfs2_ail *first_ai, *ai, *tmp;
        int done = 0;
 
        gfs2_log_lock(sdp);
+       head = &sdp->sd_ail1_list;
        if (list_empty(head)) {
                gfs2_log_unlock(sdp);
                return;
@@ -228,6 +219,7 @@ static void gfs2_ail2_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
 {
        struct list_head *head = &ai->ai_ail2_list;
        struct gfs2_bufdata *bd;
+       struct gfs2_inode *bh_ip;
 
        while (!list_empty(head)) {
                bd = list_entry(head->prev, struct gfs2_bufdata,
@@ -237,6 +229,8 @@ static void gfs2_ail2_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
                list_del(&bd->bd_ail_st_list);
                list_del(&bd->bd_ail_gl_list);
                atomic_dec(&bd->bd_gl->gl_ail_count);
+               bh_ip = GFS2_I(bd->bd_bh->b_page->mapping->host);
+               gfs2_meta_cache_flush(bh_ip);
                brelse(bd->bd_bh);
        }
 }