From 15d00c0b91ca776b51b5ab04f79ab35b06670d30 Mon Sep 17 00:00:00 2001 From: Steven Whitehouse Date: Fri, 18 Aug 2006 15:51:09 -0400 Subject: [GFS2] Fix leak of gfs2_bufdata This fixes a memory leak of struct gfs2_bufdata and also some problems in the ordered write handling code. It needs a bit more testing, but I believe that the reference counting of ordered write buffers should now be correct. This is aimed at fixing Red Hat bugzilla: #201028 and #201082 Signed-off-by: Steven Whitehouse --- fs/gfs2/lops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fs/gfs2/lops.c') diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index af03bf380f46..04bceb75ff23 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c @@ -464,7 +464,7 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) struct gfs2_inode *ip = GFS2_I(mapping->host); tr->tr_touched = 1; - if (!list_empty(&bd->bd_list_tr) && + if (list_empty(&bd->bd_list_tr) && (ip->i_di.di_flags & GFS2_DIF_JDATA)) { tr->tr_num_buf++; list_add(&bd->bd_list_tr, &tr->tr_list_buf); @@ -473,7 +473,7 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le) } gfs2_trans_add_gl(bd->bd_gl); gfs2_log_lock(sdp); - if (!list_empty(&le->le_list)) { + if (list_empty(&le->le_list)) { if (ip->i_di.di_flags & GFS2_DIF_JDATA) sdp->sd_log_num_jdata++; sdp->sd_log_num_databuf++; @@ -640,10 +640,10 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) bd_le.le_list); list_del(&bd1->bd_le.le_list); sdp->sd_log_num_databuf--; - bh = bd1->bd_bh; if (bh) { bh->b_private = NULL; + get_bh(bh); gfs2_log_unlock(sdp); wait_on_buffer(bh); brelse(bh); -- cgit v1.2.3-55-g7522