gfs2-utils: master - libgfs2: patch to update gfs1 superblock correctly

Abhijith Das adas at fedoraproject.org
Fri Mar 21 15:21:33 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=f8d4e5711ab545af5ec577386e4e2ce0c111cea1
Commit:        f8d4e5711ab545af5ec577386e4e2ce0c111cea1
Parent:        dce63a150565f91d1386e2444d6cb378e8be1dd5
Author:        Abhi Das <adas at redhat.com>
AuthorDate:    Fri Mar 21 10:15:24 2014 -0500
Committer:     Abhi Das <adas at redhat.com>
CommitterDate: Fri Mar 21 10:15:24 2014 -0500

libgfs2: patch to update gfs1 superblock correctly

gfs2-utils uses the gfs2_sb structure as a template to operate on
both gfs1 and gfs2 superblocks. Some fields of the gfs1 superblock
are not in gfs2 and are replaced by padded fields. These padded
fields were not being written out after modification and were
instead being zeroed out, thereby causing corruption.
This patch fixes gfs2_sb_out() to write out the padded fields.

Resolves: rhbz#1053668
Signed-off-by: Abhi Das <adas at redhat.com>
---
 gfs2/libgfs2/ondisk.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
index dcc537e..3fbc63f 100644
--- a/gfs2/libgfs2/ondisk.c
+++ b/gfs2/libgfs2/ondisk.c
@@ -132,15 +132,20 @@ void gfs2_sb_out(const struct gfs2_sb *sb, char *buf)
 
 	CPOUT_32(sb, str, sb_fs_format);
 	CPOUT_32(sb, str, sb_multihost_format);
+	CPOUT_32(sb, str, __pad0);                        /* gfs sb_flags */
 
 	CPOUT_32(sb, str, sb_bsize);
 	CPOUT_32(sb, str, sb_bsize_shift);
+	CPOUT_32(sb, str, __pad1);                        /* gfs sb_seg_size */
 
 	gfs2_inum_out(&sb->sb_master_dir, (char *)&str->sb_master_dir);
 	gfs2_inum_out(&sb->sb_root_dir, (char *)&str->sb_root_dir);
 
 	CPOUT_08(sb, str, sb_lockproto, GFS2_LOCKNAME_LEN);
 	CPOUT_08(sb, str, sb_locktable, GFS2_LOCKNAME_LEN);
+	gfs2_inum_out(&sb->__pad2, (char *)&str->__pad2); /* gfs rindex */
+	gfs2_inum_out(&sb->__pad3, (char *)&str->__pad3); /* gfs quota */
+	gfs2_inum_out(&sb->__pad4, (char *)&str->__pad4); /* gfs license */
 #ifdef GFS2_HAS_UUID
 	memcpy(str->sb_uuid, sb->sb_uuid, 16);
 #endif


More information about the cluster-commits mailing list