From: Abhijith Das <adas@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] fsck.gfs2: special handling for gfs1 sb update
Date: Mon, 24 Feb 2014 22:15:15 -0500 (EST) [thread overview]
Message-ID: <951042609.5397017.1393298115981.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1392648480-5085-1-git-send-email-anprice@redhat.com>
Since the gfs2_sb structure doesn't contain all the gfs1 fields,
updating using lgfs2_sb_write overwrites some gfs1 fields with
zeros and breaks the filesystem.
We need to update only the gfs2_sb fields and leave the rest as-is.
Signed-off-by: Abhi Das <adas@redhat.com>
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 0f33aa6..cf45a5c 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -60,6 +60,9 @@ static int block_mounters(struct gfs2_sbd *sdp, int block_em)
}
}
+ if (sdp->gfs1)
+ return lgfs2_sb_update(sdp);
+
if (lgfs2_sb_write(&sdp->sd_sb, sdp->device_fd, sdp->bsize)) {
stack;
return -1;
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 6372128..a20e369 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -754,6 +754,7 @@ static inline unsigned int rgrp_size(struct rgrp_tree *rgrp)
extern int build_master(struct gfs2_sbd *sdp);
extern void lgfs2_sb_init(struct gfs2_sb *sb, unsigned bsize);
extern int lgfs2_sb_write(const struct gfs2_sb *sb, int fd, const unsigned bsize);
+extern int lgfs2_sb_update(struct gfs2_sbd *sbp);
extern int build_journal(struct gfs2_sbd *sdp, int j,
struct gfs2_inode *jindex);
extern int build_jindex(struct gfs2_sbd *sdp);
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
index 2cc9a98..641d875 100644
--- a/gfs2/libgfs2/structures.c
+++ b/gfs2/libgfs2/structures.c
@@ -105,6 +105,17 @@ void lgfs2_sb_init(struct gfs2_sb *sb, unsigned bsize)
#endif
}
+int lgfs2_sb_update(struct gfs2_sbd *sbp)
+{
+ struct gfs2_buffer_head *bh;
+
+ bh = bread(sbp, GFS2_SB_ADDR >> sbp->sd_fsb2bb_shift);
+ gfs2_sb_out(&sbp->sd_sb, bh->b_data);
+ brelse(bh);
+ fsync(sbp->device_fd); /* make sure the change gets to disk ASAP */
+ return 0;
+}
+
int lgfs2_sb_write(const struct gfs2_sb *sb, int fd, const unsigned bsize)
{
int i, err = -1;
next prev parent reply other threads:[~2014-02-25 3:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-17 14:47 [Cluster-devel] [PATCH 1/4] libgfs2: Superblock building and writing improvements Andrew Price
2014-02-17 14:47 ` [Cluster-devel] [PATCH 2/4] gfs2-utils: Ensure sb_uuid uses are guarded Andrew Price
2014-02-17 14:47 ` [Cluster-devel] [PATCH 3/4] libgfs2: Add support for new leaf hint fields Andrew Price
2014-02-18 10:36 ` Steven Whitehouse
2014-02-18 11:02 ` Andrew Price
2014-02-17 14:48 ` [Cluster-devel] [PATCH 4/4] mkfs.gfs2: Remove a dead structure Andrew Price
2014-02-17 15:12 ` [Cluster-devel] [PATCH 1/4] libgfs2: Superblock building and writing improvements Bob Peterson
2014-02-25 3:15 ` Abhijith Das [this message]
2014-02-25 12:20 ` [Cluster-devel] [PATCH] fsck.gfs2: special handling for gfs1 sb update Andrew Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=951042609.5397017.1393298115981.JavaMail.zimbra@redhat.com \
--to=adas@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.