Gitweb:
http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 4e3322cb8fcb1109fc5f16131b467127c229fa5d
Parent: 42396b11a75672caa2c8220d76fd6fb8721cef89
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Fri Jun 25 13:45:36 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Fri Jun 25 13:45:36 2010 -0500
gfs2_fsck ends on journal recovery
This patch adds a return code to function write_journal and correctly
processes it as it does in the upstream code.
rhbz#606468
---
gfs2/fsck/fs_recovery.c | 6 +++---
gfs2/libgfs2/libgfs2.h | 4 ++--
gfs2/libgfs2/structures.c | 11 ++++++-----
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index 654556c..d5ccb75 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -553,9 +553,9 @@ out:
log_info( _("jid=%u: Failed\n"), j);
reinit:
if (query( _("Do you want to clear the journal instead? (y/n)")))
- write_journal(sdp, sdp->md.journal[j], j,
- sdp->md.journal[j]->i_di.di_size /
- sdp->sd_sb.sb_bsize);
+ error = write_journal(sdp, sdp->md.journal[j], j,
+ sdp->md.journal[j]->i_di.di_size /
+ sdp->sd_sb.sb_bsize);
else
log_err( _("jid=%u: journal not cleared.\n"), j);
return error;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index c94c05d..c8cb958 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -478,8 +478,8 @@ extern int gfs2_dirent_next(struct gfs2_inode *dip, struct
gfs2_buffer_head *bh,
extern void build_height(struct gfs2_inode *ip, int height);
extern void unstuff_dinode(struct gfs2_inode *ip);
extern unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size);
-extern void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip,
- unsigned int j, unsigned int blocks);
+extern int write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip,
+ unsigned int j, unsigned int blocks);
/**
* device_size - figure out a device's size
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index ea0ca6a..ce12174 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -86,12 +86,12 @@ build_sb(struct gfs2_sbd *sdp, const unsigned char *uuid)
}
}
-void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j,
- unsigned int blocks)
+int write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j,
+ unsigned int blocks)
{
struct gfs2_log_header lh;
unsigned int x;
- uint64_t seq = RANDOM(blocks);
+ uint64_t seq = ((blocks) * (random() / (RAND_MAX + 1.0)));
uint32_t hash;
unsigned int height;
@@ -109,14 +109,14 @@ void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip,
unsigned int j,
for (x = 0; x < blocks; x++) {
struct gfs2_buffer_head *bh = get_file_buf(ip, x, TRUE);
if (!bh)
- die("write_journal\n");
+ return -1;
bmodified(bh);
brelse(bh);
}
for (x = 0; x < blocks; x++) {
struct gfs2_buffer_head *bh = get_file_buf(ip, x, FALSE);
if (!bh)
- die("write_journal\n");
+ return -1;
memset(bh->b_data, 0, sdp->bsize);
lh.lh_sequence = seq;
@@ -136,6 +136,7 @@ void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip,
unsigned int j,
printf("\nJournal %u:\n", j);
gfs2_dinode_print(&ip->i_di);
}
+ return 0;
}
void