diff options
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/log.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 8fcfb784f906..f49a12e24086 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -237,10 +237,7 @@ static void gfs2_ail2_empty_one(struct gfs2_sbd *sdp, struct gfs2_ail *ai) | |||
237 | list_del(&bd->bd_ail_st_list); | 237 | list_del(&bd->bd_ail_st_list); |
238 | list_del(&bd->bd_ail_gl_list); | 238 | list_del(&bd->bd_ail_gl_list); |
239 | atomic_dec(&bd->bd_gl->gl_ail_count); | 239 | atomic_dec(&bd->bd_gl->gl_ail_count); |
240 | if (bd->bd_bh) | 240 | brelse(bd->bd_bh); |
241 | brelse(bd->bd_bh); | ||
242 | else | ||
243 | kmem_cache_free(gfs2_bufdata_cachep, bd); | ||
244 | } | 241 | } |
245 | } | 242 | } |
246 | 243 | ||
@@ -583,6 +580,7 @@ static void log_flush_commit(struct gfs2_sbd *sdp) | |||
583 | struct list_head *head = &sdp->sd_log_flush_list; | 580 | struct list_head *head = &sdp->sd_log_flush_list; |
584 | struct gfs2_log_buf *lb; | 581 | struct gfs2_log_buf *lb; |
585 | struct buffer_head *bh; | 582 | struct buffer_head *bh; |
583 | int flushcount = 0; | ||
586 | 584 | ||
587 | while (!list_empty(head)) { | 585 | while (!list_empty(head)) { |
588 | lb = list_entry(head->next, struct gfs2_log_buf, lb_list); | 586 | lb = list_entry(head->next, struct gfs2_log_buf, lb_list); |
@@ -599,9 +597,20 @@ static void log_flush_commit(struct gfs2_sbd *sdp) | |||
599 | } else | 597 | } else |
600 | brelse(bh); | 598 | brelse(bh); |
601 | kfree(lb); | 599 | kfree(lb); |
600 | flushcount++; | ||
602 | } | 601 | } |
603 | 602 | ||
604 | log_write_header(sdp, 0, 0); | 603 | /* If nothing was journaled, the header is unplanned and unwanted. */ |
604 | if (flushcount) { | ||
605 | log_write_header(sdp, 0, 0); | ||
606 | } else { | ||
607 | unsigned int tail; | ||
608 | tail = current_tail(sdp); | ||
609 | |||
610 | gfs2_ail1_empty(sdp, 0); | ||
611 | if (sdp->sd_log_tail != tail) | ||
612 | log_pull_tail(sdp, tail); | ||
613 | } | ||
605 | } | 614 | } |
606 | 615 | ||
607 | /** | 616 | /** |