cluster: RHEL57 - gfs2_edit: Don't prematurely release buffer_heads

Andrew Price andyp at fedoraproject.org
Mon May 9 22:04:25 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=081fb6f7ee25d39560e15f5a2d3cd6adc80ee698
Commit:        081fb6f7ee25d39560e15f5a2d3cd6adc80ee698
Parent:        87176e1e6c6ac1b83f719c4683e0dd9745cac411
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Mon May 9 18:17:34 2011 +0100
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Mon May 9 23:02:38 2011 +0100

gfs2_edit: Don't prematurely release buffer_heads

save_indirect_blocks() currently releases buffer_heads which should be left
queued to save off later. This patch, backported from commit d8c8af9 upstream,
leaves them on the queue to avoid corruption.

Resolves: rhbz#698298

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 gfs2/edit/savemeta.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index a724807..1ca5b42 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -214,7 +214,7 @@ static int save_block(int fd, int out_fd, uint64_t blk)
 
 	if (blk > last_fs_block) {
 		fprintf(stderr, "\nWarning: bad block pointer '0x%llx' "
-			"ignored in block (block %llu (%llx))",
+			"ignored in block (block %llu (0x%llx))",
 			(unsigned long long)blk,
 			(unsigned long long)block, (unsigned long long)block);
 		return 0;
@@ -312,7 +312,9 @@ static void save_indirect_blocks(int out_fd, osi_list_t *cur_list,
 		if (height != hgt) { /* If not at max height */
 			nbh = bread(&sbd, indir_block);
 			osi_list_add_prev(&nbh->b_altlist, cur_list);
-			brelse(nbh);
+			/* The buffer_head needs to be queued ahead, so
+			   don't release it!
+			   brelse(nbh);*/
 		}
 	} /* for all data on the indirect block */
 }
@@ -358,8 +360,8 @@ static void save_inode_data(int out_fd)
 	    (S_ISDIR(inode->i_di.di_mode) ||
 	     (gfs1 && inode->i_di.__pad1 == GFS_FILE_DIR)))
 		height++;
-	else if (height && !block_is_systemfile() &&
-		 !S_ISDIR(inode->i_di.di_mode))
+	else if (height && !(inode->i_di.di_flags & GFS2_DIF_SYSTEM) &&
+		 !block_is_systemfile() && !S_ISDIR(inode->i_di.di_mode))
 		height--;
 	osi_list_add(&metabh->b_altlist, &metalist[0]);
         for (i = 1; i <= height; i++){


More information about the cluster-commits mailing list