cluster: RHEL59 - gfs2_convert: clear out old di_mode before setting it
Bob Peterson
rpeterso at fedoraproject.org
Mon Jun 3 18:32:43 UTC 2013
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=07b91f6a29c3340f42c1d3bd5d759c55f17298f2
Commit: 07b91f6a29c3340f42c1d3bd5d759c55f17298f2
Parent: 6bd4127590889ecfb8c27da15f633dfbb688be3f
Author: Bob Peterson <rpeterso at redhat.com>
AuthorDate: Tue Dec 18 14:14:08 2012 -0600
Committer: Bob Peterson <rpeterso at redhat.com>
CommitterDate: Mon Jun 3 12:51:51 2013 -0500
gfs2_convert: clear out old di_mode before setting it
This patch clears the dinode 'di_mode' inode type field before
setting it based on the GFS1 value. In rare circumstances
(e.g. fsck.gfs2 ran on a GFS1 file system and created lost+found
with both GFS1 and GFS2 data) di_mode might have an old value.
In these cases, simply doing a logical 'or' with the correct
value produces an invalid value. Zeroing it out beforehand ensures
it is set correctly based on the GFS1 type.
rhbz#887374
---
gfs2/convert/gfs2_convert.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 074d1ee..206adfb 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -907,6 +907,7 @@ static int adjust_inode(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh)
inode->i_di.di_num.no_formal_ino = sbp->md.next_inum; ;
/* Fix the inode type: gfs1 uses di_type, gfs2 uses di_mode. */
+ inode->i_di.di_mode &= ~S_IFMT;
switch (inode->i_di.__pad1) { /* formerly di_type */
case GFS_FILE_DIR: /* directory */
inode->i_di.di_mode |= S_IFDIR;
More information about the cluster-commits
mailing list