FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 09-06-2011, 12:00 PM
Andrew Price
 
Default gfs2_edit: Fix segfault in find by resource group

When using 'find' on block types which require searching by resource
group, a segfault occurs in __gfs2_next_rg_meta due to rgd->bh being
empty. This patch fixes the segfault by reading in the resource group
data, thus populating rgd->bh, prior to the search.

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

diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 2182704..dd0cf60 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -2056,7 +2056,7 @@ static uint64_t find_metablockoftype_slow(uint64_t startblk, int metatype, int p
static uint64_t find_metablockoftype_rg(uint64_t startblk, int metatype, int print)
{
struct osi_node *n, *next = NULL;
- uint64_t blk;
+ uint64_t blk, errblk;
int first = 1, found = 0;
struct rgrp_tree *rgd;
struct gfs2_rindex *ri;
@@ -2087,6 +2087,9 @@ static uint64_t find_metablockoftype_rg(uint64_t startblk, int metatype, int pri
for (; !found && n; n = next){
next = osi_next(n);
rgd = (struct rgrp_tree *)n;
+ errblk = gfs2_rgrp_read(&sbd, rgd);
+ if (errblk)
+ continue;
first = 1;
do {
if (gfs2_next_rg_metatype(&sbd, rgd, &blk, metatype,
@@ -2098,6 +2101,7 @@ static uint64_t find_metablockoftype_rg(uint64_t startblk, int metatype, int pri
}
first = 0;
} while (blk <= startblk);
+ gfs2_rgrp_relse(rgd);
}
if (!found)
blk = 0;
--
1.7.6
 

Thread Tools




All times are GMT. The time now is 10:13 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org